How to plot several 2D histograms with the same COLZ scale

Hello,

I’m trying to plot several 2D histograms on different pads in the same canvas.

I need all of them to have the same scale (colorbar) but each of them is showing up with its unique colorbar so comparing between them is not easy. Here’s the code of how I’m defining the color scale and the way I’m plotting the two histograms. I appreciate if anyone can help me with this.

[code]const Int_t NRGBs = 5;
const Int_t NCont = 255;
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);

c1->cd(1);
h1->SetTitle("");
h1->Scale(factor);
h1->Draw(“COLZ”);
gStyle->SetOptStat(0);

c1->cd(2);
h2->SetTitle("");
h2->Scale(factor);
h2->Draw(“COLZ”);
gStyle->SetOptStat(0);[/code]

My go-to solution for plotting several histograms is to create a THStack then draw it with the “nostack” option. I do wish that class was called “TMultiHist” and had to be told explicitly to “stack” histograms, but for some reason it’s reversed.

If you draw a THStack “nostackcolz” then the Z axis scale should be common to all the non-stacked histograms.

For TGraphs there is the more-intuitive TMultiGraph, but it has fewer fancy features (e.g. no “pads” option).

Jean-François