Showing an histogram value out of range with different color

Hi rooters

Lets’ say that I have a 2D histograms and I set up the maximum and minimum values (with SetMaximum and SetMinimum methods). Is it possible to show the bins that are outside the [minimum, maximum[ range in a specific display?

For instance:

  • using “lego2z” with a color not in the palette
  • using “text” with a different style.

One could use a method like “SetColorOverMax(kBlue)”, “SetColorBelowMin(kRed)”

I don’t know if it is yet feasible or if implies some development. I am using root 5.22/00

Thanks

I guess the way to do that would be to change your palette accordingly to the minimum and maximum you set. For all the value above the maximum you put a clearly different color and the same for the values below the minimum. The following macro shows how to define your own palette:

{
   TCanvas *c = new TCanvas("c","Contours",600,0,600,600);
   TF2 *f1 = new TF2("f2","0.1+(1-(x-2)*(x-2))*(1-(y-2)*(y-2))",1,3,1,3);
   const Int_t Number = 5;
   Double_t Red[Number] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
   Double_t Green[Number] = { 0.01, 0.02, 0.39, 0.68, 0.97 };
   Double_t Blue[Number] = { 0.17, 0.39, 0.62, 0.79, 0.97 };
   Double_t Stops[Number] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
   Int_t nb=50;
   TColor::CreateGradientColorTable(Number,Stops,Red,Green,Blue,nb);
   f2->SetContour(nb);
   f2->Draw("surf1z");
}

Hi Olivier

I understand that I can redefine my palette.

But how can I force a TH2 cell to have a specific color?
I could use a THStack with 2 histograms, as shown in the tutorials, but this seems overkilling to me.

Thanks.

you cannot force a color to a specific cell the color for a cell is taken from the palette according to the content of the cell. But you can define your palette in a way that all the cell having a content equal or greater than a given value are all the same. (that is what you asked seems to me)