Plotting to mother canvas instead of sub-pad

Can someone explain to me why the following code fails to draw the histogram on the first sub pad (appears to be on the mother canvas) and, naturally, how to get ROOT to draw it on the first sub pad. I feel like I’m missing something really basic here.

  TH1F* hFrame = new TH1F("hFrame","Ellipse",100, -2, 2);
  hFrame->SetMinimum(-2);
  hFrame->SetMaximum(2);

  TCanvas* c2 = new TCanvas("c2","c2", 900, 400);
  c2->Divide(2,1);

  c2->cd(1);
  hFrame->DrawClone();

ROOT Version: 6.18/04
Platform: MacOS 10.14.6


Try with: hFrame->DrawCopy();

If it doesn’t help, try to play with (there is a long standing problem with ROOT + Cocoa):

Why don’t you simply use hFrame->Draw(); ? It works fine.

DrawCopy works fine. Thanks.

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