Get rid of the exponent in scientific notation

as shown in the figure, how to get rid of the exponent while maintaining SetMaxDigits() ?
below are the codes that produces the plot (note that the SetNoExponent() cant be used because it’s a standalone TAxis.)

c1 = r.TCanvas("c1","Examples of TGaxis",10,10,700,500);

frame = c1.DrawFrame(-15,-0.12,15,0.12,"Horizontal Phase Space Ellipse");
frame.GetYaxis().SetMaxDigits(2)
# frame.GetYaxis().SetNoExponent(r.kTRUE) # not working for standalone TAxis


ROOT Version: 6.26 (conda-forge)
Platform: Ubuntu 22.04
Compiler: gcc9


I did not test with conda, but running directly PyROOT (e.g. python3 -i yourmacro.py), I don’t see the problem running those 4 lines (adding import ROOT as r, enabling the SetNoExponent line and removing the “;”, as I suppose it’s a Python script). I get


If you run only those lines (maybe add c1.SaveAs("c1.png") if the canvas closes immediately), do you still see the problem? If yes, it probably has something to do with conda, as it runs fine for me, but if not, and since you are doing other stuff to get the image you showed, there may be something else that’s affecting your plot. Maybe try adding c1.Modified() and c1.Update() after drawing, or post a minimal running code that shows the problem.

thanks for the suggestions (and i will try it) but probably you get me wrong. What I want to do is to keep those labels on the y axis as (-100, -50, 0 , 50 ,100) without the X10^-3

Then don’t define the frame with the y-axis from -0.12 to 0.12, try -120 to 120.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.