Drawing options for one dimensional histograms
Drawing options for one dimensional histograms
//
// To see the output of this macro, click here
// Here we create a Canvas named "c1" with all default parameters
//
gROOT.Reset(c1)
TCanvas c1(c1,"The FillRandom example",700,900)
TPad pad1(pad1,"The pad with the function",0.03,0.62,0.47,0.30,46)
TPad pad2(pad2,"The pad with the histogram",0.51,0.62,0.47,0.30,46)
TPad pad3(pad3,"The pad with the histogram",0.03,0.02,0.94,0.55,46)
pad1.Draw
pad2.Draw
pad3.Draw
//
// We connect the ROOT file generated in a previous tutorial
// see A Batch example creating/filling/saving histograms/ntuples on file
//
TFile example(hsimple.root)
example.ls
// Draw a global picture title
TPaveLabel title(0.1,0.94,0.9,0.98,"Drawing options for one dimensional histograms")
title.SetFillColor(16)
title.Draw
//
// Draw histogram hpx in first pad with the default option.
pad1.cd
hpx.DrawCopy
TPaveLabel label1(-3.5,300,-1,340,"Default option")
label1.SetFillColor(24)
label1.Draw
//
// Draw hpx as a lego. Clicking on the lego area will show
// a "transparent cube" to guide you rotaing the lego in real time.
pad2.cd
hpx.DrawCopy(lego1)
TPaveLabel label2(0.4,0.8,0.9,0.95,"option Lego1")
label2.SetFillColor(24)
label2.Draw
TPaveLabel label2a(-0.93,-1.08,0.25,-0.92,"Click on lego to rotate")
label2a.SetFillColor(24)
label2a.Draw
//
// Draw hpx with its errors and a marker.
pad3.cd
pad3.SetGridx
pad3.SetGridy
hpx.SetMarkerSize(1.5)
hpx.SetMarkerStyle(21)
hpx.Draw(e1p)
TPaveLabel label3(2,250,3.5,275,"option e1p")
label3.SetFillColor(24)
label3.Draw
//
// The following illustrates how to add comments using a PaveText.
// Attributes of text/lines/boxes added to a PaveText can be modified.
// The AddText function returns a pointer to the added object.
TPaveText pave(-3.78,232,-1.5,370)
pave.SetFillColor(25)
TText *t1=pave.AddText("You can move")
t1.SetTextColor(4)
t1.SetTextSize(0.05)
pave.AddText(Title and Stats pads")
pave.AddText("X and Y axis")
pave.AddText("You can modify bin contents")
pave.Draw
[ROOT page] [Class index] [Top of the page]
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or
contact the developers with any questions or problems regarding ROOT.