Draw dashed lines on TGraph2D

I have a 2D TGraph, shown below.

I want to draw two (ideally dashed) lines at the centre of the graph.
What I’m doing now:

c17->cd();
graph->Draw("cont4 z");

TLine *line = new TLine(2,0.4,2,0.6);
line->Draw("same");

and then I’ll add a second TLine for the second line.

At the moment this line doesn’t plot.

I tried to play around with TAttLine to make the lines dashed and of a different colour, but couldn’t get it to work.

Am I doing anything wrong so far?
Can we still draw lines on a 2D Graph in this way or is there a more complicated way?

Try with “cont[0123]z”.
I’m afraid “cont4” is actually a “surf” at theta = 0.
See also:
[Vertical shaded area
[gPad->GetUxmin(),GetUxmax() for 2D histogram
[Drawing a single contour over a TGraph2D using cont4

Thanks for your answer.

After implementing what you suggested, I get this (see below).

Is it possible to get a line whilst keeping the same uniform coloured 2D Graph as before?


How about “cont5”.

Now it’s just lines.
The line is always being printed now though.

I am now trying with other “cont” options.


Well, it seems you need to have a look at the links that I gave you in my first post here.

Thanks, I managed.