Colour gradient in 2D lego-plots

Hi,

I am looking for a way to change the colour coding for bins in a lego plot.
For example I have two lego plots. Let’s say in plot A the maximum bin has 200 entries and the minimum bin has 0 entries. In plot B the maximum bin has just 100 entries. So, when I draw both plots with ‘LEGO2Z’ in both plots the maximum bins have a colour gradient from blue to red (for palette ‘1’).
Although I change in both plots the z-axis to have the same range (for example: 0-200) the colour gradient stays the same for plot B, i.e. the maximum bin still has a colour gradient from blue to red.

Apparently changing the z-axis does not has an influence on the object responsible for the colour gradient colouring the lego-bins in my plot.

Maybe somebody has a suggestion for me who I can adjust the color gradient in a lego-plot

Cheers & thanks for any idea,
Thomas

I have tried to reproduce with the following macro what you are describing here. Seems to me the result I obtain is correct.

{
   TCanvas *c1 = new TCanvas("c1","c1",600,800);
   c1->Divide(1,2);
   TH2F *h1 = new TH2F("h1","h1",40,-4,4,40,-4,4);
   TH2F *h2 = new TH2F("h2","h2",40,-4,4,40,-4,4);
   gStyle->SetPalette(1);

   Double_t a,b;
   for (Int_t i=0;i<5000;i++) {
      gRandom->Rannor(a,b);
      h1->Fill(a-1.5,b-1.5,2.);  
      h2->Fill(a+1.5,b+1.5);
   }
   h2->SetMaximum(h1->GetMaximum());

   c1->cd(1);
   h1->Draw("lego2z");

   c1->cd(2);
   h2->Draw("lego2z");
}

Hi,

my problem has been fixed. Apparently my C-file had some ‘contamination’ from useless SetContour-lines. Before I saved my plots I played around with lego & contour etc. options that somehow entered the C-file (even after choosing just ‘lego2’ as final draw option).
Now SetMinimum/SetMaximum also changes the colour gradient. :smiley:

Cheers & Thanks – Thomas