Specify minimum/maximum colour for colour palette

In this example:

  gStyle -> SetOptStat(0);
  gStyle -> SetOptTitle(0);
  TH2 * h = new TH2F("h2", "h2", 2, 0.0, 2.0, 2, 0.0, 2.0);
  h -> SetBinContent(2, 2, 100);
  h -> SetBinContent(1, 2, 50);
  h -> SetBinContent(2, 1, - 25);
  TCanvas * c = new TCanvas;
  h -> Draw("COLZ");

the output is:

I would like to specify and show on the colour palette the colour corresponding to -100 even if there is no bin with such minimum value in the TH2. How can I do that?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Try to set h->SetMinimum(-100);.


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.