Hi!
I am using root-6.05.02. If I try to draw a TH2 with the colz option I just get a white canvas (with the proper X-Y axis shown in black).
For example, if I try the first example here:
{
TCanvas *c1 = new TCanvas("c1","c1",600,400);
TH2F *hcol1 = new TH2F("hcol1","Option COLor example ",40,-4,4,40,-20,20);
Float_t px, py;
for (Int_t i = 0; i < 25000; i++) {
gRandom->Rannor(px,py);
hcol1->Fill(px,5*py);
}
gStyle->SetPalette(kBird);
hcol1->Draw("COLZ");
return c1;
}
Any advice? - I haven’t seen any other post regarding this exact problem, although I guess I could change the palette every time I open root, as suggested to others with similar problems, which would be quite annoying
Thank you!
I see someone marked this message as the solution to the problem.
But it isn’t
I can set a palette to get a non-white plot every time I open root, yes, but my problem is that I am forced to do this every time (while in the many other systems I’ve worked on, I didn’t have to do it). And while typing gStyle->SetPalette(kBird) in every root session would have saved me having to write this post, in the long run I’ll save time if I don’t have to
So I guess the question should have been then: how to I specify the default palette to not be all white, something that works in interpreted code or in compiled code, etc.
And if anyone knows: why my root setup decided to set the palette as white instead of rainbow like everyone else’s? (!?)
{
TH2F *hcol1 = new TH2F("hcol1","Option COLor example ",40,-4,4,40,-20,20);
Float_t px, py;
for (Int_t i = 0; i < 25000; i++) {
gRandom->Rannor(px,py);
hcol1->Fill(px,5*py);
}
gStyle->SetPalette(1);
hcol1->Draw("COLZ");
}
If you are obliged to set the palette to get it right it means that the default palette has been changed somewhere … rootlogon.C was one possibility… but it can be somewhere else.