I am trying to simply overlay a TGraph on a TProfile histogram but it doesn’t work. Here is the code I use:
TCanvas *cOverlay = new TCanvas("cOverlay","TGraph and TProfile Overlay", 1200, 1200);
cOverlay->Clear();
cOverlay->Cd();
myTProfile->Draw();
myTGraph->Draw("C");
In this case the TProfile is drawn but the Tgraph is not. I have tried swapping the draw lines but it didn’t help. Trying various draw options didn’t solve the problem.
But if I replace myTProfile with a normal TH1 in the sample code above, then everything is fine and I have both TH1 and TGraph overlayed.
Would somebody please advice on this issue? Thank you in advance.