Cannot Draw in Embedded canvas

I’m having trouble drawing a TH2D in an embedded canvas. When I try:

TCanvas * canv = (TCanvas*)this->display->GetCanvas(); canv->cd(); dataHist->Draw("colz"); canv->Update();
where dataHist is a TH2D* and display is a TRootEmbeddedCanvas*, nothing happens, the canvas stays blank. I have checked that there is data in the TH2D. Obviously this is embedded in a TApplication and Run() is called. Any Ideas?

Hi,

The following code draws a TH2D object in the created embedded canvas: TCanvas *c1 = fEcan->GetCanvas(); c1->cd(); TF2 *f2 = new TF2("f2","(xygaus + xygaus(5) + xylandau(10))",-4,4,-4,4); Double_t params[] = {130,-1.4,1.8,1.5,1, 150,2,0.5,-2,0.5, 3600,-2,0.7,-3,0.3}; f2->SetParameters(params); TH2D *h2 = new TH2D("h2","xygaus + xygaus(5) + xylandau(10)",100,-4,4,100,-4,4); h2->FillRandom("f2",40000); h2->Draw("colz"); c1->Modified(); c1->Update(); and I hope you have created your application in a way explained on page 380 of ROOT User’s Guide ( ftp://root.cern.ch/root/doc/chapter26.pdf )

Cheers, Ilka