TAxis::SetMaxDigits function does not appear to work on the z-axis of a 2D histogram. I cannot see an effect, in any event. Reproducer follows.
df = ROOT.RDataFrame(1000).Define('rand1', 'gRandom->Uniform(0, 0.001)').Define('rand2', 'gRandom->Uniform(0, 0.001)')
h = df.Histo2D(('h', 'h', 10, 0, 0.001, 10, 0, 0.001), 'rand1', 'rand2')
Notice that the y-axis ranges from “0” to “0.001” and the z-axis from “0.004” to “0.018”
Notice that the y-axis now ranges from “0” to “1” x10-3, while the z-axis remains unchanged.
Notice that the y- and z-axes have the adjusted range format, while the x-axis remains unchanged.
ROOT Version: master
Compiler: Not Provided
I think the problem is that drawing with colz you don’t get a 3D plot, and the colour scale is a TPaletteAxis (not a TAxis), which does not have SetMaxDigits, as well as other TAxis methods. If you draw with “lego2”, for instance, you get a z-axis on which you can use SetMaxDigits, etc.
Edit: you can actually get the axis from TPalette:
palette = h.GetListOfFunctions().FindObject("palette")
zax = palette.GetAxis()
then update the Pad or canvas.
yes, the axis pointer returned by GetZaxis() is not the same as the one used in the palette:
root  hpxpy->Draw("colz")
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root  hpxpy->GetZaxis()
(TAxis *) 0x7fb867275628
root  auto palette = (TPaletteAxis *)hpxpy->GetListOfFunctions()->FindObject("palette");
root  cout << palette->GetAxis() << endl;
Thank you, @couet and @dastudillo, for the explanation. This behavior is not intuitive, as one expects
"COLZ" to simply be a way to represent the z-axis, but I imagine it would be quite a lift to change. Perhaps such a change could be incorporated in ROOT 7; I’ve submitted a JIRA feature request here.
This is now fixed in master.
Actually the fix has side effects in stressGraphics. I will revert until I found where it comes from. It should be fine soon.
It is now properly fixed. Sorry for the delay.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.