Draw color plots using different color palettes.
As only one palette is active, one need to use TExec
to be able to display plots using different palettes on the same pad.
When a pad is painted, all its elements are painted in the sequence of Draw calls (See the difference between Draw and Paint in the TPad documentation); for TExec it executes its command - which in the following example sets palette for painting all objects painted afterwards. If in the next pad another TExec changes the palette, it doesn’t affect the previous pad which was already painted, but it will affect the current and those painted later.
The following macro illustrate this feature.
{
Double_t Length[3] = {0.00, 0.50, 1.00};
if (!initialized) {
for (int i = 0; i < 50; i++)
return;
}
}
{
Double_t Length[3] = {0.00, 0.50, 1.00};
if (!initialized) {
for (int i = 0; i < 50; i++)
return;
}
}
{
TF2 *f3 =
new TF2(
"f3",
"0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))", 1, 3, 1, 3);
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TStyle * gStyle
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
static Int_t CreateGradientColorTable(UInt_t Number, Double_t *Stops, Double_t *Red, Double_t *Green, Double_t *Blue, UInt_t NColors, Float_t alpha=1., Bool_t setPalette=kTRUE)
Static function creating a color table with several connected linear gradients.
TExec is a utility class that can be used to execute a C++ command when some event happens in a pad.
A 2-Dim function with parameters.
void Draw(Option_t *option="") override
Draw this function with its current attributes.
void SetPalette(Int_t ncolors=kBird, Int_t *colors=nullptr, Float_t alpha=1.)
See TColor::SetPalette.
- Author
- Olivier Couet
Definition in file multipalette.C.