# TLine: Line in 2D TGraph

**URL:** <https://root-forum.cern.ch/t/tline-line-in-2d-tgraph/51151>\
**Category:** Newbie\
**Created:** [August 10, 2022, 7:54pm UTC](https://root-forum.cern.ch/t/tline-line-in-2d-tgraph/51151 "2022-08-10T19:54:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheScientist](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@TheScientist](https://root-forum.cern.ch/u/TheScientist)\
**Post date:** [August 10, 2022, 7:54pm UTC](https://root-forum.cern.ch/t/tline-line-in-2d-tgraph/51151/1 "2022-08-10T19:54:05Z")

</div>

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:

```auto
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()

```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [August 15, 2022, 12:01pm UTC](https://root-forum.cern.ch/t/tline-line-in-2d-tgraph/51151/2 "2022-08-15T12:01:39Z")

</div>

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.
