# Problem with logarithmic color axis/colz with TNtuple

**URL:** <https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058>\
**Category:** ROOT\
**Created:** [March 30, 2012, 7:04am UTC](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058 "2012-03-30T07:04:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdst](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@jdst](https://root-forum.cern.ch/u/jdst)\
**Post date:** [March 30, 2012, 7:04am UTC](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058/1 "2012-03-30T07:04:32Z")

</div>

Hi,

I am trying to plot 3 sets of data using TNtuple with a logarithmic color/z-axis.  
Actually in my case “SetLogz()” doesn’t work.  
More precisely, it’s possible to make the z-axis logarithmic but it won’t be linked to the color code in the plot

Below one simple example :

```auto
#include <TStyle.h>
#include <TCanvas.h>
#include <TNtuple.h>
{
TNtuple* nt = new TNtuple("nt","","a:b:c");
TCanvas *Can = new TCanvas("Can","",200,10,600,400);

Double_t x[16] = {1.00, 2.00, 6.00, 7.00, 3.00, 10.00, 0.20, 5.55,
      20.50, 9.75, 1.50, 8.00, 5.00, 0.95, 3.85, 8.70};
Double_t y[16] = {1.00, 2.00, 6.00, 7.00, 3.00, 10.00, 0.20, 5.55,
      20.50, 9.75, 1.50, 8.00, 5.00, 0.95, 3.85, 8.70};
Double_t z[16] = {0.001, 2.50, 600.00, 0.00001, 30.00, 10.001, 0.00020, 500000.55,
      20.50, 9.75, 280000.50, 8.00, 5.00, 0.95, 3.85, 8.70};

Double_t x3, y3, z3;

for(Int_t h1 =0;h1<16;++h1)
{
x3 = x[h1];
y3 = y[h1];
z3 = z[h1]; nt->Fill(x3,y3,z3);
}
gPad->SetLogz(1);
Can->SetTickx(1);
gStyle->SetOptStat(0);
gStyle->SetPalette(1,0);
nt->SetMarkerStyle(20);
nt->SetMarkerSize(1);
nt->Draw("b:a:c","c","colz");
}
```

Normally the point with z=280000.50 should be in red when z-axis is logarithmic, but it’s not the case.

Thanks

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [March 30, 2012, 7:39am UTC](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058/2 "2012-03-30T07:39:56Z")

</div>

A brutal fix:

```auto
if (gPad->GetLogz()) nt->Draw("b:a:log10(c)*(c>0)", "", "colz");
else nt->Draw("b:a:c", "", "colz");

```

---

<div class="post-metadata">

**Author:** ![jdst](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@jdst](https://root-forum.cern.ch/u/jdst)\
**Post date:** [March 30, 2012, 11:31pm UTC](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058/3 "2012-03-30T23:31:03Z")

</div>

Thanks for the answer but the problem still remains, z-axis is still disconnected to the color code in the plot.

For instance for the isolated point with z=20.5, if we take log10(20.5), approximately = 1.3, logarithmic scale shows us that z would be around 0.2 - 0.3.

Any other ideas?

Cheers.

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [March 31, 2012, 6:49am UTC](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058/4 "2012-03-31T06:49:20Z")

</div>

This seems to be a bug in ROOT (the numbers on the “z” scale, i.e. on the color palette, are wrong in “Logz” mode) and it seems to be closely related to [How plot only fit result of the TGraph?](https://root-forum.cern.ch/t/how-plot-only-fit-result-of-the-tgraph/14012/15)

---

<div class="post-metadata">

**Author:** ![jdst](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@jdst](https://root-forum.cern.ch/u/jdst)\
**Post date:** [March 31, 2012, 5:29pm UTC](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058/5 "2012-03-31T17:29:07Z")

</div>

OK, I posted a bug report.

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [April 3, 2012, 5:52pm UTC](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058/6 "2012-04-03T17:52:56Z")

</div>

[https://sft.its.cern.ch/jira/browse/ROOT-4230](https://sft.its.cern.ch/jira/browse/ROOT-4230)  
[https://savannah.cern.ch/bugs/?93229](https://savannah.cern.ch/bugs/?93229)

---

<div class="post-metadata">

**Author:** ![jdst](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@jdst](https://root-forum.cern.ch/u/jdst)\
**Post date:** [April 3, 2012, 9:20pm UTC](https://root-forum.cern.ch/t/problem-with-logarithmic-color-axis-colz-with-tntuple/14058/7 "2012-04-03T21:20:42Z")

</div>

Yes I know, no solution, or modify ROOT…
