This macro draws all the high definition palettes available in ROOT.
It generates a png file for each palette and one pdf file, with a table of content, containing all the palettes.
In ROOT, more than 60 high quality palettes are predefined with 255 colors each.
These palettes can be accessed "by name" with gStyle->SetPalette(num)
. num can be taken within the enum given in the previous link. As an example gStyle->SetPalette(kCividis)
will select the following palette.
{
c =
new TCanvas(
"c",
"Contours",0,0,500,500);
TF2 *f2 =
new TF2(
"f2",
"0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",0.999,3.002,0.999,3.002);
c->Print(
"palettes.pdf(", opt.
Data());
c->Print(
"palettes.pdf)", opt.
Data());
else
c->Print(
"palettes.pdf", opt.
Data());
}
void palettes()
{
draw_palette(
kBird,
"Bird");
draw_palette(
kOcean,
"Ocean");
draw_palette(
kArmy,
"Army");
draw_palette(
kBeach,
"Beach");
draw_palette(
kCMYK,
"CMYK");
draw_palette(
kCandy,
"Candy");
draw_palette(
kFall,
"Fall");
draw_palette(
kLake,
"Lake");
draw_palette(
kMint,
"Mint");
draw_palette(
kNeon,
"Neon");
draw_palette(
kPearl,
"Pearl");
draw_palette(
kPlum,
"Plum");
draw_palette(
kRose,
"Rose");
draw_palette(
kRust,
"Rust");
draw_palette(
kSolar,
"Solar");
draw_palette(
kCool,
"Cool");
}
@ kInvertedDarkBodyRadiator
winID h TVirtualViewer3D TVirtualGLPainter p
R__EXTERN TStyle * gStyle
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
A 2-Dim function with parameters.
virtual void SetContour(Int_t nlevels=20, const Double_t *levels=nullptr)
Set the number and values of contour levels.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
To draw Mathematical Formula.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
A Pave (see TPave) with text, lines or/and boxes inside.
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
virtual void SetName(const char *name="")
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void SetPalette(Int_t ncolors=kBird, Int_t *colors=nullptr, Float_t alpha=1.)
See TColor::SetPalette.
- Author
- Olivier Couet
Definition in file palettes.C.