TWiki> Computing Web>RootTips (03 Oct 2008, _47C_61UK_47O_61eScience_47OU_61Cambridge_47L_61UCS_47CN_61karl_32harrison002? ) EditAttach

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)

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 03 Oct 2008 - _47C_61UK_47O_61eScience_47OU_61Cambridge_47L_61UCS_47CN_61karl_32harrison002?
This site is powered by the TWiki collaboration platform Powered by Perl 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