TLine: Line in 2D TGraph

I am trying to draw a vertical line in 2D graph. However, line is not showing up for some reason. I am trying to draw line from x-axis 47 to all the way to top of the y-axis. Here is my code:

g = ROOT.TGraph2D()

for x in range(128):
    for y in range(645):
        z = adc13[x][y]
        g.SetPoint(x + 128 * y,x,y,z)

line = ROOT.TLine(47,0,47,644) #x1,y1,x2,y2
line.GetColor(1)
c1 = ROOT.TCanvas("c1")

g.Draw("TRI2 Z")
ROOT.gPad.Update()
g.SetTitle("Muon Tracks")
g.GetXaxis().SetTitle("Channel Number")
g.GetYaxis().SetTitle("Time Ticks")
g.GetZaxis().SetTitle("ADC")
  
c1.SetTheta(0.0+90)
c1.SetPhi(0.0+0.001)
ROOT.gStyle.SetHistTopMargin(0)
c1.Draw()

Your code is not complete so we cannot run it. Just a few remarks:

  • You never draw the line. So it cannot show.
  • You do not need to Draw c1 at the end
  • be aware that “TRI2” will produce a 3D plot and that TLine is 2D.