I am trying to plot lines on a TCanvas along with many polygons. Currently, I am representing each polygon with a TGraph, and adding them together into one TMultigraph. For the lines I am making use of TLines.
I need to draw the lines such that they are on top of one set of the polygons, but behind (obscured by) another set of polygons. Is this possible to do with a combination of TLine and TMultigraph or should I be using different ROOT classes? I tried representing the lines with two-point TGraphs added to the TMultigraph, but they would not show up when plotting the TMultigraph with a wide variety of draw options.
A multigraph contains on graphs.
The best way, in order to have only one multigraph, is to do TGraph with 2 points instead of TLines. Then you can choose the order
Thanks for your reply. I also tried using TGraphs to represent the lines, as I mentioned above. It doesn’t seem to be working. Take a look at the code snippet below:
I tried running this with the “AL” draw options and the “AFL” draw options, neither of which give me the result I’m looking for - in this case, I would like the green line to be on top of the red triangle, but hidden behind the blue triangle. Again, I’m trying to draw lines over some polygons, but not all of them - some polygons should obscure the lines. Changing the order in which I add the three TGraphs above doesn’t seem to affect anything.
I’ve also tried drawing the TMultiGraph with other TGraphs (using the “same” draw option) but that doesn’t seem to be working either.