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.
void Pal1()
{
Double_t Length[3] = {0.00, 0.50, 1.00};
if (!initialized) {
for (int i = 0; i < 50; i++)
return;
}
}
void Pal2()
{
Double_t Length[3] = {0.00, 0.50, 1.00};
if (!initialized) {
for (int i = 0; i < 50; i++)
return;
}
}
void multipalette()
{
TF2 *f3 =
new TF2(
"f3",
"0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))", 1, 3, 1, 3);
}
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
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)
TExec is a utility class that can be used to execute a C++ command when some event happens in a pad.
void Draw(Option_t *option="") override
Default Draw method for all objects.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
- Author
- Olivier Couet
Definition in file multipalette.C.