Hey,
is it somehow possible to draw more than one TF1/TH1D in one canvas for function comparison.
If it is not possible to combine the data, would it be possible to only draw the shapes?
BR
Hey,
is it somehow possible to draw more than one TF1/TH1D in one canvas for function comparison.
If it is not possible to combine the data, would it be possible to only draw the shapes?
BR
Try something->Draw(); and then something_else->Draw(“SAME”).
See:
http://root.cern.ch/root/html/THistPainter.html#HP060
http://root.cern.ch/root/html/TF1.html#TF1:Draw
Option SAME will be very likely enough.
If you need to compute a common range for all the plots you may need:
root.cern.ch/root/html/THStack.html
Thank you for your answers.
->Draw(“SAME”) works but only if used “directly” for some reason.
Does not work (example):
TF1* function[4];
for (int i(0); i<4; ++i)
{
function[i] = new TF1();
function[i]->Draw("SAME");
}
Works (example):
TF1* function[4];
for (int i(0); i<4; ++i)
{
function[i] = new TF1();
}
function[0]->Draw("SAME");
function[1]->Draw("SAME");
function[2]->Draw("SAME");
function[3]->Draw("SAME");
Any ideas?
BR
better do:
TF1* function[4];
function[0] = new TF1();
function[0]->Draw();
for (int i=1; i<4; ++i) {
function[i] = new TF1();
function[i]->Draw("SAME");
}
Thank you. This way it works like expected.
BR
Note, the option “SAME” requires that something has already been drawn before (it will reuse axes and so on). So, the very first “Draw” command must be without “SAME”.