In the following code, the graphs.SetMinimum(0)
and graphs.SetMaximum(10)
are ignored, if you look at the saved .png image.
import ROOT
ROOT.gROOT.SetBatch(True)
canvas = ROOT.TCanvas("canv0", "Graphs", 0,0,936,860)
graphs = ROOT.TMultiGraph()
graph = ROOT.TGraph()
graph.SetPoint(0,1,1)
graph.SetPoint(1,2,2)
graphs.Add(graph, "l")
graphs.Draw("A")
graphs.SetMinimum(0)
graphs.SetMaximum(10)
graphs.GetXaxis().SetLimits(0,3)
canvas.Update()
canvas.SaveAs("test_graph.png")
This can be fixed either by not running in batch mode, or by setting the x axis limits before the graphs.Setminimum(0)
. Is it a bug that only in batch mode it demands a certain ordering of the commands?
ROOT Version: current master branch
Platform: Ubuntu 18.04
Compiler: gcc 7.4
Python: 3.6.8