TLegend
class description - source file - inheritance tree
public:
TLegend TLegend(Coord_t x1, Coord_t y1, Coord_t x2, Coord_t y2, const Text_t* header = 0, Option_t* option = brNDC)
TLegend TLegend()
TLegend TLegend(const TLegend& legend)
virtual void ~TLegend()
TLegendEntry* AddEntry(TObject* obj, const Text_t* label = 0, Option_t* option = lpf)
TClass* Class()
virtual void Clear(Option_t* option)
virtual void Copy(TObject& obj)
virtual void DeleteEntry()
virtual void Draw(Option_t* option)
virtual void EditEntryAttFill()
virtual void EditEntryAttLine()
virtual void EditEntryAttMarker()
virtual void EditEntryAttText()
TLegendEntry* GetEntry()
Float_t GetEntrySeparation()
virtual const Text_t* GetHeader() const
Float_t GetMargin()
virtual void InsertEntry(const Text_t* objectName = 0, const Text_t* label = 0, Option_t* option = lpf)
virtual TClass* IsA() const
virtual void Paint(Option_t* option)
virtual void PaintPrimitives()
virtual void Print(Option_t* option)
virtual void SavePrimitive(ofstream& out, Option_t* option)
void SetDefaults()
virtual void SetEntryLabel(const Text_t* label)
virtual void SetEntryOption(Option_t* option)
void SetEntrySeparation(Float_t entryseparation)
virtual void SetHeader(const Text_t* header = 0)
void SetMargin(Float_t margin)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
protected:
TList* fPrimitives list of TLegendEntries
Float_t fEntrySeparation separation between entries, as a fraction of
Float_t fMargin fraction of total width used for symbol
TLegend Matthew.Adam.Dobbs@Cern.CH, September 1999
Legend of markers/lines/boxes to represent objects with marker/line/fill
attributes
(the methods employed are very similar to those in TPaveText class)
TLegend(): TPave(), TAttText()
TPadLegend do-nothing default constructor
TLegend( Coord_t x1, Coord_t y1,Coord_t x2, Coord_t y2, const Text_t *header, Option_t *option)
:TPave(x1,y1,x2,y2,4,option), TAttText(12,0,1,42,0)
___________________________________
TLegend normal Contructor
A TLegend is a Pave with several TLegendEntry(s)
The pave is defined with default coords, bordersize and option
x1,y1,x2,y2 are the coordinates of the Legend in the current pad
(in NDC by default!)
text is left adjusted and vertically centered = 12
Angle=0 (degrees), color=1 (black)
helvetica-medium-r-normal scalable font = 42
(will use bold = 62 for header)
size =0 (calculate this later when number of entries is known)
header is the "title" that will be displayed at the top of the legend
it is treated like a regular entry and supports TLatex. The default
is no header (header = 0).
Options are the same as for TPave Default = "brNDC"
Here's an example of a Legend created with TLegend
/*
*/
The Legend part of this plot was created as follows:
leg = new TLegend(0.4,0.6,0.89,0.89);
leg->AddEntry(fun1,"One Theory","l");
leg->AddEntry(fun3,"Another Theory","f");
leg->AddEntry(gr,"The Data","p");
leg->Draw();
// oops we forgot the blue line... add it after
leg->AddEntry(fun2,"#sqrt{2#pi} P_{T} (#gamma) latex formula","f");
// and add a header (or "title") for the legend
leg->SetHeader("The Legend Title");
leg->Draw();
where fun1,fun2,fun3 and gr are pre-existing functions and graphs
You can edit the TLegend by right-clicking on it.
TLegend( const TLegend &legend )
copy constuctor
~TLegend()
TLegend default destructor
TLegendEntry* AddEntry(TObject* obj, const Text_t* label, Option_t* option)
Add a new entry to this legend
obj is the object to be represented
label is the text you wish to associate with obj in the legend
Options are:
L draw line associated w/ TAttLine if obj inherits from TAttLine
P draw polymarker assoc. w/ TAttMarker if obj inherits from TAttMarker
F draw a box with fill associated w/ TAttFill if obj inherits TAttFill
void Clear( Option_t *)
Clear all entries in this legend --- including the header!
void Copy( TObject &obj )
copy this legend into obj
void DeleteEntry()
Delete entry at the mouse position
void Draw( Option_t *option )
Draw this legend with its current attributes
void EditEntryAttFill()
Edit the fill attributes for the entry pointed to be the mouse
void EditEntryAttLine()
Edit the line attributes for the entry pointed to be the mouse
void EditEntryAttMarker()
Edit the marker attributes for the entry pointed to be the mouse
void EditEntryAttText()
Edit the text attributes for the entry pointed to be the mouse
TLegendEntry* GetEntry()
Get entry pointed to by the mouse
This method is mostly a tool for other methods inside this class
const Text_t* GetHeader()
returns the header, which is the title that appears at the top
of the legend
void InsertEntry( const Text_t* objectName, const Text_t* label, Option_t* option)
Add a new entry before the entry at the mouse position
void Paint( Option_t* option )
Paint this legend with its current attributes
void PaintPrimitives()
Paint the entries (list of primitives) for this legend
NOTE: if we want an Int_t mode
it can be added later... but I understand whyaas
void Print( Option_t* option )
dump this TLegend and its contents
void SavePrimitive( ofstream &out, Option_t* )
Save this legend as C++ statements on output stream out
to be used with the SaveAs .C option
void SetEntryLabel( const Text_t* label )
edit the label of the entry pointed to by the mouse
void SetEntryOption( Option_t* option )
edit the option of the entry pointed to by the mouse
void SetHeader( const Text_t *header )
Sets the header, which is the "title" that appears at the top of the
TLegend
Inline Functions
Float_t GetEntrySeparation()
Float_t GetMargin()
void SetDefaults()
void SetEntrySeparation(Float_t entryseparation)
void SetMargin(Float_t margin)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
Author: Matthew.Adam.Dobbs 06/09/99
Last update: 2.23/02 17/09/99 16.14.47 by Rene Brun
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *
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.