TGraph2D: logarithmic z-axis

This problem is now fixed in 534 and in the trunk.
With your macro, I now get the attached picture.


Thanks a lot Olivier for the excellent support! I am very impressed with the promptness of your replies and the fix. I managed to get my plot done with the trunk version obtained from git.

Jochen

That’s just my job :slight_smile:
Thanks :slight_smile:

Hi, it seems that this problem comes back in Root 6.07/07.
I test these codes:

{
   TCanvas *c = new TCanvas("c","Graph2D example",0,0,600,400);
   Double_t x, y, z, P = 6.;
   Int_t np = 200;
   TGraph2D *dt = new TGraph2D();
   TRandom *r = new TRandom();
   for (Int_t N=0; N<np; N++) {
      x = 2*P*(r->Rndm(N))-P;
      y = 2*P*(r->Rndm(N))-P;
      z = (sin(x)/x)*(sin(y)/y)+0.2;
      dt->SetPoint(N,x,y,z);
   }
   gStyle->SetPalette(1);
   gPad->SetLogz();
   dt->SetMarkerStyle(20);
   dt->Draw("pcolz");
   return c;
}

And get the result as the attached figure.
Could any one verify this and give me a solution?

Thanks,
Hieu

It might be an other problem because you are not using the same plotting option. I will check.

Can you explain what you think is wrong in the plot you get … seems to me it looks fine …
I am surely missing something …

You can see there is a mismatch between the colors of points and the color’s z-values.
For example, in the 3D graph, the blue points correspond to z=210^(-1). However, on the color palette, the blue color corresponds to z=510^(-3).

If you plot this graph in linear scale of z. Such thing does not happen.

Both ROOT 5.34/36 and 6.06/04 behave the same way.
The graph is drawn with log-z but the color is still linear-z (improperly shown in the palette’s axis as being log, too).

I see. I hope that ROOT developers will consider this as a bug to be fixed soon.

You may open a bug report on JIRA in order to keep track of that problem.

Yes, please a Jira report will help to follow it.

I don’t have a CERN account to create a bug report in Jira. It seems that an external light weight account that I created doesn’t work.
Can any one of you help to create such bug report?
Thanks.

Done:
sft.its.cern.ch/jira/browse/ROOT-8200

Now fixed in master:

{
   TCanvas *c = new TCanvas("c","Graph2D example",0,0,600,400);
   Double_t x, y, z, P = 6.;
   Int_t np = 200;
   TGraph2D *dt = new TGraph2D();
   TRandom *r = new TRandom();
   for (Int_t N=0; N<np; N++) {
      x = 2*P*(r->Rndm(N))-P;
      y = 2*P*(r->Rndm(N))-P;
      z = (sin(x)/x)*(sin(y)/y)+0.2;
      dt->SetPoint(N,x,y,z);
   }
   gStyle->SetPalette(1);
   gPad->SetLogz();
   dt->SetMarkerStyle(20);
   dt->Draw("pcolz");
   c->SetPhi(0.00001);
   c->SetTheta(0.00001);
}

1 Like

Hi Oliver, I have a this problem how do I find the correct root version with this fix in lxplus? Or, is there way to do a work-around?

I guess @amadio can tells you how to access a different ROOT version on lxplus.

Note: you will need ROOT 6.12/04 or newer.

@couet Could you please mark in the JIRA issue which are the affected versions and fixed ones? I think that would make it easier.

@IzaakWN You can load ROOT from lxplus7 like this:

$ source /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.14.00/x86_64-centos7-gcc48-opt/root/bin/thisroot.sh

Please just remember to adjust the platform if needed. Cheers,

Hi @couet, @Wile_E_Coyote & @amadio, thanks for your replies. I was using 6.06/09 (via CMSSW_8_1_0), but I managed to get it working with root 6.12/07 (via CMSSW_10_2_0).
Cheers.

1 Like

Done . Thanks for the reminder.