TH2 COLZ: two hists on one pad with different color tables

Dear rooters,

is it possible to draw two histograms on one pad using the SAME option and different color tables?

Motivation: I want to overplot (highlight) a subset of the data in a 2D histogram.

Histogram range and binning are identical. Histogram 2 is a tcut version of histogram 1.

The basic idea was something like:

gStyle->SetPalette(53);
hist01->Draw("COLZ");
gStyle->SetPalette(51);
hist02->Draw("COLZ same");

which did not work…

the next idea was

TStyle *myhistStyle01 = new TStyle();
myhistStyle01->SetPalette(51);

TStyle *myhistStyle02 = new TStyle();
myhistStyle02->SetPalette(53);

myhistStyle01->cd();
hist01->Draw("COLZ");
myhistStyle02->cd();
hist02->Draw("COLZ same");

In both cases the colors of both histograms are changed, propably because I keep changing a pad/canvas property.

I’d be happy for any suggestions!

Thanks,

Markus

Hi Markus,

Is this what you’re looking for?
root.cern.ch/drupal/content/how- … ame-canvas

Thank you yus,

works like a charm!

TExec *ex1 = new TExec("ex1","gStyle->SetPalette(53);");
TExec *ex2 = new TExec("ex2","gStyle->SetPalette(51);");

hist01->Draw("COL");
ex1->Draw();
hist01->Draw("COLZ same");
ex2->Draw();
hist02->Draw("COLZ same");