I want to plot two graphs on the same plot. I have used this but its not plotting.
TGraph *gr1 = new TGraph(n,x1,y1);
TGraph *gr2 = new TGraph(n,x2,y2);
gr2->SetMarkerColor(2);
//gr2->SetMarkerStyle(21);
// create a multigraph and draw it
TMultiGraph *mg = new TMultiGraph();
mg->Add(gr1);
mg->Add(gr2);
mg->Draw("AP*");
so I used this option but it plots only one of the graphs.
c2->cd(1);
// create the 1st TGraph
TGraph *gr1 = new TGraph(n,x1,y1);
// gr1->Draw("AP*");
// create the 2nd TGraph
TGraph *gr2 = new TGraph(n,x2,y2);
gr2->SetMarkerColor(2);
//gr2->Draw("AP*");
gr1->Draw("A*");
gr2->Draw("A*");
what should I do for two graphs to be on the same graph?
yes please I tried this one as well but it didnt work. My macro uses a big data file in order for it to run that I cannot upload here. the thing is the two data has different axis as well. I do not know if I can upload image here for you to see that two graphs seperately
In that case, you should divide your canvas in 2 subpad using Divide and draw each graph on a diffirend pad using cd. Do you know how or do you want an example?