What is your best way to increment colors?

Hello Everyone,

Say I have 20 or so histograms I want to plot with a THStack.
How can I increment the color in a smart way as to produce a nice looking plot???
Assuming I have and integer i and a white background whats the smartest approach?

I want to avoid:
[ul]
[li] Colors that clash with the background (e.g. white on white bg , yellow on white bg , light shades of colors)[/li]
[li] Ugly/Clashing colors[/li]
[li] Lots of extra code[/li]
[li] Very ambiguous shades[/li][/ul]

Cheers,
Whit

Here is an example:

{
        Int_t n  = 39;
        Int_t nb = 7;
        TH2D *hist[n];
        THStack *a = new THStack("a","LegoPlot");

        Int_t i=1;
        for(Int_t ihist=0; ihist<n; ihist++ ) {
              TString hn="hist_"; hn+=ihist;
              hist[ihist] = new TH2D(hn,hn,nb,0,nb,20,0,10);
              hist[ihist]->SetBinContent(ihist+1,i,double(ihist));
              hist[ihist]->SetBinContent(ihist  ,i,double(ihist));
              hist[ihist]->SetBinContent(ihist-1,i,double(ihist));
              hist[ihist]->SetFillColor(ihist);
              a->Add(hist[ihist]);
              i++;
              i++;
        }
        a->Draw("LEGO10");
}

Then the way you choose colors is up to you …
The is example showing how to define palette here:
root.cern.ch/drupal/content/how- … or-palette

Also you can pick color in the color wheel. See:
root.cern.ch/root/html/TAttFill.html#F1

I often use the attached image.


Could this image be added into the official ROOT pages?

it is already.

Yes I know, but the “official ready to use” plot goes up to 40, and maybe it would be nice if it went up to 255 (yes, I myself have been using that plot when defining colors).
Well, I’m not really familiar with TColorWheel :wink:

The thing is that above 50 it depends which palette you are using … so it will never be the same …