Setmarkerstyle for individual points

Hi,

Is there a way to set the marker style of individual points in TGraph?

So I have a TGraph with N points, n1,n2,…nN. Now say I want to set the points n2,n7,n8 apart from the rest of the points. So I would like to set the style of these points differently from the rest of the points. Is there a way to do this without casting a new TGraph out of these 3 points?

Thanks!

  • Sujeewa

Use either a TMarker for individual points or a TMultiGraph for a collection of TGraphs.

Rene

Hi Rene,

Thanks! But is there a way to actually set some points only (not all points) in a TGraph with different attributes? If I do mygraph->SetMarkerColor(kBlue); it sets all points in mygraph to blue. What if I want just points 3,7 and 8 to be blue? so the same TGraph will have two sets of points in two different colors.

  • Sujeewa

No, this would be an ecological disaster. It is better to group in one graph all points with the same color and do not switch the color for each point. Follow my advice with the TMultiGraph and you will see that the solution is even simpler than what you propose.

Rene

Ok, thanks Rene - I had already tried that and yes it worked!

  • Sujeewa