Get multiple graphs on the same canvas

Comb.C (1.1 KB)

Here I have multiple graphs from different root files. I want to plot these graphs on the same canvas including the data points. I also want to set title for graph. Can someone help me with this?

You can use canvas->Divide(), see for example this tutorial. In your case,for 5 zones, you could do canvas->Divide(3,2); to have 3 cols x 2 rows, or Divide(2,3) for 2x3.
https://root.cern/doc/master/classTPad.html#a2714ddd7ba72d5def84edc1fbaea8658

I want them on top of other.

For that, add them to a TMultiGraph.

1 Like

Hi,

you say you want your graphs on the same canvas, and yet you create 5 different canvases. Can you explain why?

Comb.C (1.2 KB)

Now here I just want to set the title of the graphs and X-axis and Y-axis titles.

It’s shown on the same page I linked above (mg->SetTitle...).

https://root.cern/doc/master/classTMultiGraph.html#MG01b

1 Like

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