1 |
|
## |
2 |
|
## $Log$ |
3 |
+ |
## Revision 1.7 2010/07/15 16:22:47 wangdy |
4 |
+ |
## change the pad right margin to allow for COLZ;use palatte from R.Reece |
5 |
+ |
## |
6 |
|
## Revision 1.6 2010/05/18 17:20:12 wangdy |
7 |
|
## small updates |
8 |
|
## |
26 |
|
""" Dayong's rootlogon file, python version """ |
27 |
|
|
28 |
|
from ROOT import * |
29 |
+ |
from array import array |
30 |
|
|
31 |
|
|
32 |
|
atlasStyle=TStyle("atlasStyle","Atlas style") |
193 |
|
tdrStyle.SetPadTopMargin(0.05) |
194 |
|
tdrStyle.SetPadBottomMargin(0.15) |
195 |
|
tdrStyle.SetPadLeftMargin(0.15) |
196 |
< |
tdrStyle.SetPadRightMargin(0.06) |
196 |
> |
tdrStyle.SetPadRightMargin(0.12) |
197 |
|
|
198 |
|
## For the Global title: |
199 |
|
tdrStyle.SetOptTitle(0) |
200 |
|
tdrStyle.SetTitleFont(42) |
201 |
|
tdrStyle.SetTitleColor(1) |
202 |
|
tdrStyle.SetTitleTextColor(1) |
203 |
< |
tdrStyle.SetTitleFillColor(0) |
203 |
> |
tdrStyle.SetTitleFillColor(10) |
204 |
|
tdrStyle.SetTitleFontSize(0.05) |
205 |
|
## tdrStyle.SetTitleH(0) ## Set the height of the title box |
206 |
|
## tdrStyle.SetTitleW(0) ## Set the width of the title box |
457 |
|
gROOT.SetStyle("mitStyle") |
458 |
|
gROOT.ForceStyle() |
459 |
|
|
460 |
+ |
def set_palette(name='default', ncontours=200): |
461 |
+ |
"""Set a color palette from a given RGB list |
462 |
+ |
stops, red, green and blue should all be lists of the same length |
463 |
+ |
see set_decent_colors for an example""" |
464 |
+ |
|
465 |
+ |
if name == 'gray' or name == 'grayscale': |
466 |
+ |
stops = [0.00, 0.34, 0.61, 0.84, 1.00] |
467 |
+ |
red = [1.00, 0.84, 0.61, 0.34, 0.00] |
468 |
+ |
green = [1.00, 0.84, 0.61, 0.34, 0.00] |
469 |
+ |
blue = [1.00, 0.84, 0.61, 0.34, 0.00] |
470 |
+ |
# elif name == "whatever": |
471 |
+ |
# (define more palettes) |
472 |
+ |
else: |
473 |
+ |
# default palette, looks cool |
474 |
+ |
stops = [0.00, 0.34, 0.61, 0.84, 1.00] |
475 |
+ |
red = [0.00, 0.00, 0.87, 1.00, 0.51] |
476 |
+ |
green = [0.00, 0.81, 1.00, 0.20, 0.00] |
477 |
+ |
blue = [0.51, 1.00, 0.12, 0.00, 0.00] |
478 |
+ |
|
479 |
+ |
s = array('d', stops) |
480 |
+ |
r = array('d', red) |
481 |
+ |
g = array('d', green) |
482 |
+ |
b = array('d', blue) |
483 |
+ |
|
484 |
+ |
npoints = len(s) |
485 |
+ |
TColor.CreateGradientColorTable(npoints, s, r, g, b, ncontours) |
486 |
+ |
gStyle.SetNumberContours(ncontours) |
487 |
+ |
|
488 |
|
|
489 |
+ |
tdrstyle() |
490 |
+ |
set_palette() |
491 |
|
|
458 |
– |
|
492 |
|
if __name__ == '__main__': |
493 |
|
## default style |
494 |
|
gROOT.SetStyle("Plain") |