ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/TdrStyles.py
Revision: 1.1
Committed: Wed Oct 3 12:03:49 2012 UTC (12 years, 7 months ago) by nmohr
Content type: text/x-python
Branch: MAIN
CVS Tags: hcpApproval, HCP_unblinding, hcpPreApp, hcpPreAppFreeze
Log Message:
Plotting style

File Contents

# Content
1 import ROOT
2 from ROOT import TStyle
3
4 def tdrStyle():
5 tdrStyle = TStyle("tdrStyle","Style for P-TDR")
6
7 # For the canvas:
8 tdrStyle.SetCanvasBorderMode(0)
9 tdrStyle.SetCanvasColor(ROOT.kWhite)
10 tdrStyle.SetCanvasDefH(600) #Height of canvas
11 tdrStyle.SetCanvasDefW(600) #Width of canvas
12 tdrStyle.SetCanvasDefX(0) #POsition on screen
13 tdrStyle.SetCanvasDefY(0)
14
15 # For the Pad:
16 tdrStyle.SetPadBorderMode(0)
17 # tdrStyle.SetPadBorderSize(Width_t size = 1)
18 tdrStyle.SetPadColor(ROOT.kWhite)
19 tdrStyle.SetPadGridX(False)
20 tdrStyle.SetPadGridY(False)
21 tdrStyle.SetGridColor(0)
22 tdrStyle.SetGridStyle(3)
23 tdrStyle.SetGridWidth(1)
24
25 # For the frame:
26 tdrStyle.SetFrameBorderMode(0)
27 tdrStyle.SetFrameBorderSize(1)
28 tdrStyle.SetFrameFillColor(0)
29 tdrStyle.SetFrameFillStyle(0)
30 tdrStyle.SetFrameLineColor(1)
31 tdrStyle.SetFrameLineStyle(1)
32 tdrStyle.SetFrameLineWidth(1)
33
34 # For the histo:
35 tdrStyle.SetHistFillColor(63)
36 # tdrStyle.SetHistFillStyle(0)
37 tdrStyle.SetHistLineColor(1)
38 tdrStyle.SetHistLineStyle(0)
39 tdrStyle.SetHistLineWidth(1)
40 # tdrStyle.SetLegoInnerR(Float_t rad = 0.5)
41 # tdrStyle.SetNumberContours(Int_t number = 20)
42
43 tdrStyle.SetEndErrorSize(2)
44 # tdrStyle.SetErrorMarker(20)
45 #tdrStyle.SetErrorX(0.)
46
47 tdrStyle.SetMarkerStyle(20)
48 tdrStyle.SetMarkerSize(1.2)
49
50 #For the fit/function:
51 tdrStyle.SetOptFit(1)
52 tdrStyle.SetFitFormat("5.4g")
53 tdrStyle.SetFuncColor(2)
54 tdrStyle.SetFuncStyle(1)
55 tdrStyle.SetFuncWidth(1)
56
57 #For the date:
58 tdrStyle.SetOptDate(0)
59 # tdrStyle.SetDateX(Float_t x = 0.01)
60 # tdrStyle.SetDateY(Float_t y = 0.01)
61
62 # For the statistics box:
63 tdrStyle.SetOptFile(0)
64 tdrStyle.SetOptStat(0) # To display the mean and RMS: SetOptStat("mr")
65 tdrStyle.SetStatColor(ROOT.kWhite)
66 tdrStyle.SetStatFont(42)
67 tdrStyle.SetStatFontSize(0.025)
68 tdrStyle.SetStatTextColor(1)
69 tdrStyle.SetStatFormat("6.4g")
70 tdrStyle.SetStatBorderSize(1)
71 tdrStyle.SetStatH(0.1)
72 tdrStyle.SetStatW(0.15)
73 # tdrStyle.SetStatStyle(Style_t style = 1001)
74 # tdrStyle.SetStatX(Float_t x = 0)
75 # tdrStyle.SetStatY(Float_t y = 0)
76
77 # Margins:
78 tdrStyle.SetPadTopMargin(0.05)
79 tdrStyle.SetPadBottomMargin(0.13)
80 tdrStyle.SetPadLeftMargin(0.13)
81 tdrStyle.SetPadRightMargin(0.05)
82
83 # For the Global title:
84
85 tdrStyle.SetOptTitle(0)
86 tdrStyle.SetTitleFont(42)
87 tdrStyle.SetTitleColor(1)
88 tdrStyle.SetTitleTextColor(1)
89 tdrStyle.SetTitleFillColor(10)
90 tdrStyle.SetTitleFontSize(0.05)
91 # tdrStyle.SetTitleH(0) # Set the height of the title box
92 # tdrStyle.SetTitleW(0) # Set the width of the title box
93 # tdrStyle.SetTitleX(0) # Set the position of the title box
94 # tdrStyle.SetTitleY(0.985) # Set the position of the title box
95 # tdrStyle.SetTitleStyle(Style_t style = 1001)
96 # tdrStyle.SetTitleBorderSize(2)
97
98 # For the axis titles:
99
100 tdrStyle.SetTitleColor(1, "XYZ")
101 tdrStyle.SetTitleFont(42, "XYZ")
102 tdrStyle.SetTitleSize(0.05, "XYZ")
103 # tdrStyle.SetTitleXSize(Float_t size = 0.02) # Another way to set the size?
104 # tdrStyle.SetTitleYSize(Float_t size = 0.02)
105 tdrStyle.SetTitleXOffset(1.)
106 tdrStyle.SetTitleYOffset(1.4)
107 # tdrStyle.SetTitleOffset(1.1, "Y") # Another way to set the Offset
108
109 # For the axis labels:
110
111 tdrStyle.SetLabelColor(1, "XYZ")
112 tdrStyle.SetLabelFont(42, "XYZ")
113 tdrStyle.SetLabelOffset(0.007, "XYZ")
114 tdrStyle.SetLabelSize(0.05, "XYZ")
115
116 # For the axis:
117
118 tdrStyle.SetAxisColor(1, "XYZ")
119 tdrStyle.SetStripDecimals(ROOT.kTRUE)
120 tdrStyle.SetTickLength(0.03, "XYZ")
121 tdrStyle.SetNdivisions(510, "XYZ")
122 tdrStyle.SetPadTickX(1) # To get tick marks on the opposite side of the frame
123 tdrStyle.SetPadTickY(1)
124
125 # Change for log plots:
126 tdrStyle.SetOptLogx(0)
127 tdrStyle.SetOptLogy(0)
128 tdrStyle.SetOptLogz(0)
129
130 # Postscript options:
131 #tdrStyle.SetPaperSize(20.,20.)
132 # tdrStyle.SetLineScalePS(Float_t scale = 3)
133 # tdrStyle.SetLineStyleString(Int_t i, const char* text)
134 # tdrStyle.SetHeaderPS(const char* header)
135 # tdrStyle.SetTitlePS(const char* pstitle)
136
137 # tdrStyle.SetBarOffset(Float_t baroff = 0.5)
138 # tdrStyle.SetBarWidth(Float_t barwidth = 0.5)
139 # tdrStyle.SetPaintTextFormat(const char* format = "g")
140 # tdrStyle.SetPalette(Int_t ncolors = 0, Int_t* colors = 0)
141 # tdrStyle.SetTimeOffset(Double_t toffset)
142 # tdrStyle.SetHistMinimumZero(kTRUE)
143
144 tdrStyle.cd()