Custom Palettes and TExec trick

Yes that’s a TExec issue witch is not stored in the pad when there is nothing in the pad before. It cannot be the first element of a pad.

[EDIT] Actually it is because if we do:

   c3->cd(1);
   c3->Draw();
   TExec *ex1 = new TExec("ex1","Pal1();");
   ex1->Draw();
   f3->Draw("surf1");

The pad is considered as empty by Draw(“surf1”) and it is rebuild.

you can do:

   c3->cd(1);
   c3->Draw();
   TExec *ex1 = new TExec("ex1","Pal1();");
   ex1->Draw();
   f3->Draw("surf1 same");

but the the axis label are missing because of SAME.

So drawing twice is the shortest/simplest way to have labels and palette.

Thank you for the information.

But do you consider my doubts regarding documentation as valid or not?

What would like to see in the doc: Some thing like:

When the pad is actually drawn painted, it goes through its elements in the sequence of Draw calls; for TExec it executes its command - which sets palette globally, so it will set the palette for painting all objects afterwards (including all other pads and their elements). 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.

Yes, something like that.

And before that to say when palette is used (so what one active palette means) -> during paint -> when pad is first drawn on screen, when it is clicked, during SaveAs (provided that I am right here). I understand that the difference between Draw and actual moment of painting is not really associated with TColor - it is a general graphics issue - but then for palette this distinction is of profound significance. Obviously if a good discussion of this is given elsewhere, one can just put a link to this discussion.

I just improved the hope of the tutorials. It will be visible online tomorrow.
Thanks for your input

Thanks. I see already the commit. Since the TExec trick is present in TColor doxygen, will you improve there as well? What about the Draw vs Paint which leads to the need of the trick?

Difference between draw and paint is exampled here.
https://root.cern/doc/master/classTPad.html

The I will refer to the tutorial in the TColor page to avoid duplication

I have added a reference to the tutorial. in the TColor page.

Great. So maybe in the tutorial or TColor doxy when introducing the link to the tutorial and thus having to express need for TExec add something like:

“Remember about the difference between Draw and Paint - see TPad”

(TPad is a link to TPad doxy page - if that was within TColor doxy, then doxygen would create it automatically I guess)

Done. will be visible tomorrow.
Thanks

I see the commit. I like it, thank you.