Home | News | Documentation | Download

To draw TEllipse in a specific range

Hi guys,

i’m trying to draw a circle over a TH2D plot. My trouble is that I’d like to see the circle only inside the extremes of TH2D axes. How can I do this?
To be clearer, I would not like to see the circumference strokes on the outside of the graph.

I was not able to find the right Draw() options.

Thanks

It is what you will get if you draw an ellipse with radius exiting the range shown by the axis.
I just tried.

I know this, what I want is to draw only the strokes of the ellipse within the range of the axes.

Example:

root [0] hpxpy->Draw("colz")
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
auto *e = new TEllipse(.5,.5,5.,5.);
e->SetFillStyle(0); // <-- Stroke only
e->SetLineColor(2);
e->SetLineWidth(5);
e->Draw();

I’m using and analogous code and I got the same plot that is in the figure of my first post. I want the ellipse pieces outside the xy range of the graph not to be drawn.

Ah ok … sorry you want the ellipse to be clipped… I thought you wanted the opposite …

This was already answered here: Clipping graphical objects with histogram axes - #2 by couet

Thank you so much!
My code works now