Custom histogram painter

From: Philip Rodrigues <p.rodrigues1_at_physics.ox.ac.uk>
Date: Tue, 10 Jun 2008 15:31:14 +0100


Hi Roottalk,
Here's a custom histogram painter that alters some behaviours of TH1::Draw, which might be useful to others. I've attached the code for it, along with a README file and some examples of usage. Details of what it can do are at the bottom of the message.

I find the changes convenient for my use cases, but they're by no means universally useful. Additionally, it runs quite a bit slower than the default, and probably doesn't do things the easiest way - just the first way I found that works.

Anyway, I'd be interested to hear if this is useful for anyone else, or of course any bugs or suggestions for improvements.

Regards,
Philip


By default, it puts the stats boxes below one another, and colours them the same colour as the histogram line. There are also some more options available to pass to TH1::Draw(). See testmypainter.C for several examples.

New options available for TH1::Draw():

"reaxis": the maximum of the y axis is rescaled to show the whole

        range of all histograms.

"reaxisboth": the maximum *and* minimum of the y axis are rescaled to

        show the whole range of all histograms. Hat tip to Chris Backhouse for
        working out how to do this


"autocolor": the line colour is chosen from a list of "preferred"
colours, in order - useful if you're plotting interactively from a TTree.
"stat": Definitely draw the stats box for this histogram, overriding
gStyle->GetOptStat(). This is useful if you have a Divide()'d TCanvas, and you want stats on one pad, but not on the other.
"nostat": Definitely *don't* draw the stats box for this histogram,
overriding gStyle->GetOptStat()

Bugs


For some reason the stat/nostat options don't work when you interactively type the commands, but work fine from an interpreted macro. I have no idea why.

Received on Tue Jun 10 2008 - 16:31:21 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 10 2008 - 17:50:01 CEST