void latexbutton() { //Canvas 1 with Latex & Graph TCanvas *c = new TCanvas("canvas1", "Canvas1 (Latex and Graph)", 500,600); c->SetEditable(kTRUE); c->cd(); TButton *b = new TButton("", "", 0.05, 0.05, 0.95, 0.95); b->SetEditable(kTRUE); b->Range(0,0,1,1); b->Draw(); b->cd(); Double_t x[4] = {0.1,0.2,0.3,0.4}; Double_t y[4] = {0.9,0.4,0.5,0.3}; TGraph *g = new TGraph(4, x, y); g->Draw(); //g->Draw("SAME") //Alternatively try this -> the graph is not visible, but the latex stays TLatex *lx = new TLatex(); lx->SetTextSize(0.05); lx->DrawLatex(0.5, 0.5, "#bar{Text}"); delete lx; //Canvas 2 with Latex TCanvas *c = new TCanvas("canvas2", "Canvas2 (Latex Only)", 500,600); c->SetEditable(kTRUE); c->cd(); TButton *b = new TButton("", "", 0.05, 0.05, 0.95, 0.95); b->SetEditable(kTRUE); b->Range(0,0,1,1); b->Draw(); b->cd(); TLatex *lx = new TLatex(); lx->SetTextSize(0.05); lx->DrawLatex(0.5, 0.5, "#bar{Text}"); delete lx; }