Draw options are treated differently for TGraph and TMultiGraph

Hi all,

I recently discovered what I consider a bug in the parsing of draw options for TGraph or TMultiGraph objects. When same is included in the draw options, the result will depend on whether the object is a TGraph or a TMultiGraph.
I know and understand, that this option is not documented and this is not the way to achieve this, but in any case the result should be the same for both types of objects.
Here is a minimal example:

from ROOT import *
import array

c = TCanvas("c","multigraphs on same pad",200,10,500,1000)
c.cd()
pad1 = TPad("TMultiGraph", "TMultiGraph", 0,0.5,1,1)
pad2 = TPad("TGraph", "TGraph", 0,0,1,0.5)

x1 = array.array("f",[1,2,3])
y1 = array.array("f",[4,7,6])
x2 = array.array("f",[3,5,6])
y2 = array.array("f",[0,9,4])
gr1 = TGraphErrors(3,x2,y2,x1, y1)

# draw thisto
h = TH1D("histo","histo", 10,0,10)
h.Fill(5,9)
pad1.Draw()
pad1.cd()
h.DrawCopy()

# Draw multigraph
mg1 = TMultiGraph()
mg1.Add(gr1)
mg1.Draw("same1")

c.cd()
pad2.Draw()
pad2.cd()
h.DrawCopy()
# Draw graph
gr1.Draw("same1")
c.SaveAs("test.pdf")

I tested this with 6.04/08 under macosx64.

same is not a valid option neither for TGraph nor TMultigraph
Invalid options can not be supported, so the result is undefined.

…And the new interface generation that the ROOT team is working on will make sure that only valid options can be specified :slight_smile:
Axel

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