How to get a histogram/graph's pointer from a Canvas?

Hello!

I’m writing a macro to generate histograms/graphs. The command used is quite simple and listed here.

TCanvas * c1 = new TCanvas();
aTree->Draw("x:y");

The problem is how to get the histogram/graph’s pointer from the Canvas, c1 in this situation.

Thanks.

Search for “Retrieving the result of Draw” in the TTree::Draw method description.
Search for “GetPrimitive” in this forum to find examples.

[quote=“Wile E. Coyote”]Search for “Retrieving the result of Draw” in the TTree::Draw method description.
Search for “GetPrimitive” in this forum to find examples.[/quote]
Thank you! “htemp” and “GetPrimitive” were used :smiley: .