Home | News | Documentation | Download

Plotting individual points on a TGraph?

Using, a TGraph (well, at least I think a TGraph would be best here), how do I go about plotting individual points? By individual points, I mean that I want to plot locations on a coordinate plane as single dots, no curves connecting the points. I’ve tried a few things, but no matter what I get a line fitted to my graph.

Additionally, is it possible to add “lines” (for lack of a better word) to a TGraph? As in, horizontal and vertical lines, purely for viewing purposes, as with, say, a sheet of graph paper?


Please read tips for efficient and successful posting and posting code

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


Just don’t include “L” or “C” when you draw the graph, e.g.

 gr->Draw("A*");

To draw a grid on the pad, you can add:

 gPad->SetGrid();

after creating the canvas; where exactly you do this may vary depending on whether you are creating your own pads.