TMultiGraph axis ranges not being used


I’m trying to use a small section of line to project a line and compare its distance to points on a graph, and show it graphically. I’ve been trying to use a TMultiGraph to hold three graphs: one with the points that are “targets”, one that holds a short line segment, and one that is a long line that projects the direction of the line segment. I then try to draw everything on top of each other, but I have limits I want to set in the X and Y that get overridden by the projected line, I’ve tried reading through forums here but I don’t know what my issue is, when I draw the plots I end up with the bounds of my axes expanding to fit the long line in the multigraph, is there a way to override this?

Please read tips for efficient and successful posting and posting code
plot_DCA_calc.C (8.2 KB)

ROOT Version: 06_22_08d
Platform: Not Provided
Compiler: Not Provided

I cannot run your macro because some data are missing. But here is a small example setting the limits of a TMultiGraph.

   TCanvas *c = new TCanvas();

   TGraph *g[3];
   Double_t x[10] = {0,1,2,3,4,5,6,7,8,9};
   Double_t y[10] = {1,2,3,4,5,5,4,3,2,1};
   TMultiGraph *mg = new TMultiGraph();
   for (int i=0; i<3; i++) {
      g[i] = new TGraph(10, x, y);
      for (int j=0; j<10; j++) y[j] = y[j]-1;

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