User Tools

Site Tools


root:colorscheme

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revisionBoth sides next revision
root:colorscheme [2010/05/05 14:16] – created decianmroot:colorscheme [2010/08/24 16:58] abuechle
Line 12: Line 12:
 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
 gStyle->SetNumberContours(NCont); gStyle->SetNumberContours(NCont);
 +</code>
 +
 +
 +and for python: 
 +<code>
 +def set_palette(name="palette", ncontours=999):
 +    """Set a color palette from a given RGB list
 +    stops, red, green and blue should all be lists of the same length
 +    see set_decent_colors for an example"""
 +
 +    if name == "gray" or name == "grayscale":
 +        stops = [0.00, 0.34, 0.61, 0.84, 1.00]
 +        red   = [1.00, 0.84, 0.61, 0.34, 0.00]
 +        green = [1.00, 0.84, 0.61, 0.34, 0.00]
 +        blue  = [1.00, 0.84, 0.61, 0.34, 0.00]
 +    # elif name == "whatever":
 +        # (define more palettes)
 +    else:
 +        # default palette, looks cool
 +        stops = [0.00, 0.34, 0.61, 0.84, 1.00]
 +        red   = [0.00, 0.00, 0.87, 1.00, 0.51]
 +        green = [0.00, 0.81, 1.00, 0.20, 0.00]
 +        blue  = [0.51, 1.00, 0.12, 0.00, 0.00]
 +
 +    s = array('d', stops)
 +    r = array('d', red)
 +    g = array('d', green)
 +    b = array('d', blue)
 +
 +    npoints = len(s)
 +    TColor.CreateGradientColorTable(npoints, s, r, g, b, ncontours)
 +    gStyle.SetNumberContours(ncontours)
 </code> </code>
root/colorscheme.txt · Last modified: 2010/08/24 17:10 by abuechle