#include "TCanvas.h" #include "TH1F.h" #include "TPaveText.h" void Histo_TPave_Canvas() { TH1F* histo; TCanvas* canvas; TPaveText* ptext; TText* text; char info[100]; histo = new TH1F("histo", "Title; x; y",10,0,10); histo -> SetStats(0); //Create canvas with two subcanvases canvas = new TCanvas("canvas","test",1); //Fill histogram for ( int i = 0; i < 10; i++ ) { histo -> Fill(i); } //Create sprintf(info,"Info I want to show"); ptext = new TPaveText(0.65,0.65,0.85,0.85,"NDC"); ptext->SetFillStyle(4000); ptext->SetBorderSize(1); text = ptext -> AddText(info); canvas -> cd(1); histo -> Draw(); ptext->Draw(); return; }