General appearance

Set background colour

To replace a grey background with white, use:


where c1 is the canvas name. It's also possible to use kWhite rather than the value 10.

(Neil Collins, 25 September 2008)

Annotating plots

Draw line

This can be done in one line using the syntax:

(new TLine(-10, 0.4, 10, 0.4))->Draw();

The arguments of the TLine constructor are co-ordinates based on the histogram axes.

(Chris Curtis, 25 September 2008)

Draw arrow

To draw an arrow on a plot at a specific place, use the same technique as for Draw line, but use TArrow rather than TLine.

All you need to do if you want the arrow in the opposite direction is to reverse the co-ordinates.

(Neil Collins, 25 September 2008)

Add legend

To add a legend to the plot, you need to do something like the following:

// Create legend object and define legend size
// First two arguments are the bottom left corner position
// and the second two are the top right corner
leg = new TLegend(0.45,0.65,0.85,0.80);
// Add legend entries, giving: Histo name, label, option for marker type
// For the marker type, l draws a line, p matches to the points used in the plot
// Option to set text size (and override legend size)
// Set legend boarder type (usually defaults to being like the stats box)
// Set background colour as white
// Draw legend on plot

(Neil Collins, 25 September 2008)

Topic revision: r2 - 03 Oct 2008 - 12:50:47 - KarlHarrison
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback