@couet This looks like a bug. The drawn lines disappear as soon as one tries any of the command lines: cst->SaveAs("test.pdf"); // the last line in the macro cst->Modified(); cst->Update(); cst->cd(0); gPad->Modified(); gPad->Update();
BTW. @YeungTLine has no “same” drawing option (just use “ln[i]->Draw();”).
The option “pads” is the faulty one. Here is the minimal reproducer.
void test () {
auto hs = new THStack("hs","");
auto h1 = new TH1F("h1","h1",100,-4,4);
h1->FillRandom("gaus",20000); hs->Add(h1);
auto c = new TCanvas();
hs->Draw("pads"); // If the option pads is selected the TText Drawn later disappear when the canvas is resized manually
gPad->Update();
c->cd(1);
auto *t = new TText(0.,400.,"Text");
t->Draw();
}
I am investigating. My guess is that the pads are rebuilt each time the stack is re-paint and what was added in the pads is dropped. I’ll see how we can fix that.