Drawing shapes on a TGraph?

I’d like to plot the location of several objects, and circles centered on those objects with some given radius. Currently, I’m plotting the locations of the objects with a TGraph. How might I go about drawing the circles on a TGraph?

For example, I may have some object located at [4,9], so there will be a marker at [4,9] on the TGraph. I know the circle in question has a radius 7, so now I want to also draw a circle, with center at [4,9] , and radius 7, on the TGraph.

Of course, if this would be easier using something other than a TGraph, I’d be more than happy to use something else.

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Hi @KAM,
try to have a look to the TEllipse class.
Adding these two lines at your code should be enough.

TEllipse *circle = TEllipse(4.,9.,7.);


Hi. Thanks! Yes, this works great.

As a follow up, is there some ROOT method to determine if ellipses intersect? For example, suppose I’ve drawn three ellipses, I want to print out the point at which they intersect (given that I know they do at some point)? Doesn’t seem to be anything like that in the ROOT docs, but maybe I should look harder. Is this possible?

Thanks again.

"same" is not needed

No, not out of the box.

genuine ellipses are difficult,
for the special case of circles you find a solution here:


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.