eicplot
trunk
EIC ROOT plotting utilities
|
#include <MultiPanelPlot.h>
Public Member Functions | |
MultiPanelPlot (Int_t nColumns=1, Int_t nRows=1, Color_t colour=kWhite) | |
virtual | ~MultiPanelPlot () |
virtual void | SetLogx (Int_t) |
virtual void | SetLogy (Int_t) |
virtual void | SetLogz (Int_t) |
virtual Int_t | GetLogx () const |
virtual Int_t | GetLogy () const |
virtual Int_t | GetLogz () const |
virtual void | Divide (Int_t nColumns=1, Int_t nRows=1, Float_t=0.f, Float_t=0.f, Int_t color=0) |
virtual void | SetLeftMargin (Float_t) |
virtual void | SetRightMargin (Float_t) |
virtual void | SetBottomMargin (Float_t) |
virtual void | SetTopMargin (Float_t) |
virtual void | Draw (Option_t *="") |
virtual TVirtualPad * | cd (Int_t panel=0) |
virtual TVirtualPad * | GetPad (Int_t panel) const |
virtual void | Clear (Option_t *="") |
virtual void | Modified (Bool_t flag=1) |
virtual Int_t | GetNPanels () const |
virtual Int_t | GetNColumns () const |
virtual Int_t | GetNRows () const |
virtual void | ApplyAxes (const std::string &) |
virtual bool | IsInLeftColumn (Int_t subpadnumber) const |
virtual bool | IsInBottomRow (Int_t subpadnumber) const |
virtual bool | IsInRightColumn (Int_t subpadnumber) const |
virtual bool | IsInTopRow (Int_t subpadnumber) const |
bool | IsSelf (const TVirtualPad *) const |
Static Public Member Functions | |
static void | test (const TString &epsName, int rows, int columns) |
Protected Member Functions | |
unsigned | ClearAxes () |
TPad & | GetSubPad () |
virtual void | PositionSubPad () |
void | ConstructXAxis (int padNumber, TH1 *histogram) |
void | ConstructYAxis (int padNumber, TH1 *histogram) |
virtual double | GetDrawableX () |
virtual double | GetDrawableY () |
virtual TH1 * | FindHistogram (TVirtualPad *) |
void | ApplyMarginForColourPalette (TVirtualPad *, TH1 *) |
Protected Attributes | |
Int_t | mNX |
Int_t | mNY |
! Number of columns of panels | |
Int_t | mLogx |
! Number of rows of panels | |
Int_t | mLogy |
! Flag for logarithmic x axes | |
Int_t | mLogz |
! Flag for logarithmic y axes | |
TPad * | mSubPad |
! Flag for logarithmic z axes | |
std::list< TGaxis * > | mAxes |
double | mLabelSize |
! All the x and y axis objects |
This class can be used to make a plot of M x N histograms sharing the same axes. The histograms are drawn with no spaces between them, and are arranged such that they are all the same size. The axes only run along the left and bottom of the page. Note that the implementation is robust under any dimension in x and y, down to and including 1 x 1. Note that it is the user's responsibility to ensure that histograms sharing axes actually have the same ranges. Each division is referred to as a 'panel' in the method names. Panels are numbered according to the usual ROOT convention for sub-pads i.e. 1 at the top left, counting left to right then top to bottom, to (M x N) at the bottom right.
erhic::MultiPanelPlot::MultiPanelPlot | ( | Int_t | nColumns = 1 , |
Int_t | nRows = 1 , |
||
Color_t | colour = kWhite |
||
) |
Constructor. Optionally set the background colour of each panel. You must create a ROOT TCanvas before creating a MultiPanelPlot.
erhic::MultiPanelPlot::~MultiPanelPlot | ( | ) | [virtual] |
Destructor
void erhic::MultiPanelPlot::ApplyAxes | ( | const std::string & | ) | [virtual] |
Draw axes.
void erhic::MultiPanelPlot::ApplyMarginForColourPalette | ( | TVirtualPad * | pad, |
TH1 * | histogram | ||
) | [protected] |
Set the TPaletteAxis position for the histogram drawn to the pad.
TVirtualPad * erhic::MultiPanelPlot::cd | ( | Int_t | panel = 0 | ) | [virtual] |
Sets the numbered panel to the active ROOT pad. An argument <= 0 sets the MultiPanelPlot itself.
void erhic::MultiPanelPlot::Clear | ( | Option_t * | = "" | ) | [virtual] |
Removes objects drawn on the panels, but does not remove the panels themselves. Use Divide() to modify the number of panels.
unsigned erhic::MultiPanelPlot::ClearAxes | ( | ) | [protected] |
Clear the existing axes. Returns the number of axis objects deleted.
void erhic::MultiPanelPlot::ConstructXAxis | ( | int | padNumber, |
TH1 * | histogram | ||
) | [protected] |
Make an x axis positioned according to the panel number, based on the x axis of the provided histogram.
void erhic::MultiPanelPlot::ConstructYAxis | ( | int | padNumber, |
TH1 * | histogram | ||
) | [protected] |
Make a y axis positioned according to the panel number, based on the y axis of the provided histogram.
void erhic::MultiPanelPlot::Divide | ( | Int_t | nColumns = 1 , |
Int_t | nRows = 1 , |
||
Float_t | = 0.f , |
||
Float_t | = 0.f , |
||
Int_t | color = 0 |
||
) | [virtual] |
Divides the plot into a number of columns and rows. The third to fifth arguments are inherited from TPad and are ignored.
void erhic::MultiPanelPlot::Draw | ( | Option_t * | option = "" | ) | [virtual] |
Draws the plot onto the active ROOT pad. It is best to draw the MultiPanelPlot once onto the canvas before drawing any objects to it, so that operations such as TCanvas::Update() work as expected.
TH1 * erhic::MultiPanelPlot::FindHistogram | ( | TVirtualPad * | pad | ) | [protected, virtual] |
Returns a pointer to the first histogram found in the pad, or NULL if no histogram can be found.
double erhic::MultiPanelPlot::GetDrawableX | ( | ) | [inline, protected, virtual] |
Returns the fraction of the total image width available for drawing panels.
double erhic::MultiPanelPlot::GetDrawableY | ( | ) | [inline, protected, virtual] |
Returns the fraction of the total image height available for drawing panels.
Int_t erhic::MultiPanelPlot::GetLogx | ( | ) | const [inline, virtual] |
Returns the logarithmic x scale setting for all panels.
Int_t erhic::MultiPanelPlot::GetLogy | ( | ) | const [inline, virtual] |
Returns the logarithmic y scale setting for all panels.
Int_t erhic::MultiPanelPlot::GetLogz | ( | ) | const [inline, virtual] |
Returns the logarithmic z scale setting for all panels.
Int_t erhic::MultiPanelPlot::GetNColumns | ( | ) | const [inline, virtual] |
Returns the number of columns of panels.
Int_t erhic::MultiPanelPlot::GetNPanels | ( | ) | const [inline, virtual] |
Returns the total number of panels (columns times rows).
Int_t erhic::MultiPanelPlot::GetNRows | ( | ) | const [inline, virtual] |
Returns the number of rows of panels.
TVirtualPad * erhic::MultiPanelPlot::GetPad | ( | Int_t | panel | ) | const [virtual] |
Returns the numbered panel. If the number is less than zero, returns a pointer to this MultiPanelPlot. If the number is greater than the number of panels, returns NULL.
TPad & erhic::MultiPanelPlot::GetSubPad | ( | ) | [protected] |
Returns the sub-pad which is divided into panels. Creates the sub-pad if it doesn't currently exist.
bool erhic::MultiPanelPlot::IsInBottomRow | ( | Int_t | subpadnumber | ) | const [virtual] |
Returns true if the number identifies a panel in the bottom row, false otherwise.
bool erhic::MultiPanelPlot::IsInLeftColumn | ( | Int_t | subpadnumber | ) | const [virtual] |
Returns true if the number identifies a panel in the left-most column, false otherwise.
bool erhic::MultiPanelPlot::IsInRightColumn | ( | Int_t | subpadnumber | ) | const [virtual] |
Returns true if the number identifies a panel in the right-most column, false otherwise.
bool erhic::MultiPanelPlot::IsInTopRow | ( | Int_t | subpadnumber | ) | const [virtual] |
Returns true if the number identifies a panel in the top row, false otherwise.
bool erhic::MultiPanelPlot::IsSelf | ( | const TVirtualPad * | pad | ) | const |
Returns true if the pad argument is this MultiPanelPlot or one of its sub-components.
void erhic::MultiPanelPlot::Modified | ( | Bool_t | flag = 1 | ) | [inline, virtual] |
Set the modified flag of the plot.
void erhic::MultiPanelPlot::PositionSubPad | ( | ) | [protected, virtual] |
Update the panel positions with current margins.
void erhic::MultiPanelPlot::SetBottomMargin | ( | Float_t | margin | ) | [virtual] |
Sets the margin at the bottom of the page, containing the horizontal axis labels, as a fraction of the page height.
void erhic::MultiPanelPlot::SetLeftMargin | ( | Float_t | margin | ) | [virtual] |
Sets the margin on the left of the page, containing the vertical axis labels, as a fraction of the page width.
void erhic::MultiPanelPlot::SetLogx | ( | Int_t | logX | ) | [virtual] |
Sets a logarithmic x scale for all panels.
void erhic::MultiPanelPlot::SetLogy | ( | Int_t | logY | ) | [virtual] |
Sets a logarithmic y scale for all panels.
void erhic::MultiPanelPlot::SetLogz | ( | Int_t | logZ | ) | [virtual] |
Sets a logarithmic z scale for all panels.
void erhic::MultiPanelPlot::SetRightMargin | ( | Float_t | margin | ) | [virtual] |
Sets the margin between the edge of the histograms and the right edge of the page, as a fraction of the page width.
void erhic::MultiPanelPlot::SetTopMargin | ( | Float_t | margin | ) | [virtual] |
Set the margin at the edge of the histograms and the top edge of the page, as a fraction of the page height.