Python - Draw Y-axis of graph on the right side (Y+ option does not work)


_ROOT Version: 6.10.00
Platform: Not Provided
_Compiler: python2


Hello! I am trying to draw the axis of a graph on the right side of the canvas, but the Y+ option is not working. Actually, nothing appears on the canvas when I use this option.
My code:

mag.GetYaxis().SetTitle(“N(<M_{V})”)
mag.GetYaxis().SetTitleFont(132)
mag.GetYaxis().SetLabelFont(132)
mag.GetYaxis().SetLabelSize(0.035)
mag.GetYaxis().SetTitleSize(0.035)
mag.GetYaxis().SetTitleOffset(1.35)
mag.GetYaxis().CenterTitle()
mag.Draw(“Y+”)
magsdss.Draw(“same”)
magdes.Draw(“same”)

Do you know what might be happening?

No …

Can you provide the “mag” data so we can try ?

The graph is defined by:

mag = TGraph(55, x, y)

Where the x and y arrays are given by:

f = TFile(“AQUARIUS2.root”)
t = f.Get(“AQUARIUS”)
nEntries = t.GetEntries()
for i in range(0,nEntries):
t.GetEntry(i)
y = np.append(y, t.GetLeaf(“y”).GetValue())
x = np.append(x, t.GetLeaf(“x”).GetValue())

When I run the code without the option Y+ (mag.Draw()) it works fine.

Ok “mag” is a TGraph. You should do:

mag.Draw(“AL Y+”)
1 Like

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