HyperPlot  v1
Bin and visualise multidimensional datasets
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Plotter Class Referenceabstract

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

Base class for all RootHistogram plotters - these just make plotting root histograms a little easier.

Definition at line 26 of file Plotter.h.

#include <Plotter.h>

Inheritance diagram for Plotter:
RootPlotter RootPlotter1D RootPlotter2D

Public Member Functions

int getColor (int i)
 
void setColor (int i, int color)
 
void usePresetColours (bool val=true)
 
void allImageFormats (bool val=true)
 
void setHistogramOwnership (bool i=1)
 
void setObjectOwnership (bool i=1)
 
 Plotter (TString canvasName, double width, double height)
 
 Plotter (const Plotter &other)
 
virtual void plot (TString plotDirectory, TString plotOptions="", TPad *pad=0, double scaleFactor=1.0)=0
 Draw the histograms and objects onto the canvas.
 
void add (TObject *histogram)
 
void addDot (double xpos, double ypos, double size, int colour=1, TString shape="circle", double sizeY=0.0)
 
void logX (bool log=1)
 
void logY (bool log=1)
 
void logZ (bool log=1)
 
void addObject (TObject *obj)
 
int getNumObjects ()
 
void setImageFormat (TString format)
 
TPad * getCanvas ()
 
void scaleTextSize (double scale)
 
void scaleAxisTitleSize (double scale)
 
void scaleAxisTitleOffset (double scale)
 
void setXAxisLabelSize (double val)
 
void setYAxisLabelSize (double val)
 
void setXAxisTitleSize (double val)
 
void setYAxisTitleSize (double val)
 
void setXAxisLabelOffset (double val)
 
void setYAxisLabelOffset (double val)
 
void setXAxisTitleOffset (double val)
 
void setYAxisTitleOffset (double val)
 
void setXAxisTickLength (double val)
 
void setYAxisTickLength (double val)
 
void setPropertiesFromTH1 (TH1 *hist)
 
void setMin (double min)
 
void setMax (double max)
 
void setBMargin (double val)
 
void setLMargin (double val)
 
void setRMargin (double val)
 
void setTMargin (double val)
 

Static Public Attributes

static TString s_imageformat = ".pdf"
 
static TString s_imageformat2 = ""
 
static TString s_legend_position = "RightTop"
 
static int s_plotterCount = 0
 
static double s_forcedMax = -999.999
 
static double s_forcedMin = -999.999
 

Protected Member Functions

virtual void setCanvasDefaults (TPad *pad)
 

Protected Attributes

TPad * _canvas
 
TLegend * _legend
 
double _forcedMax
 
double _forcedMin
 
std::vector< TObject * > _objToPlot
 
std::vector< TObject * > _histograms
 
std::vector< int > _colours
 
double _lMargin
 
double _rMargin
 
double _tMargin
 
double _bMargin
 
double _xAxisTitleOffset
 
double _yAxisTitleOffset
 
double _xAxisLabelOffset
 
double _yAxisLabelOffset
 
double _xAxisTickLength
 
double _yAxisTickLength
 
double _xAxisLabelSize
 
double _yAxisLabelSize
 
double _xAxisTitleSize
 
double _yAxisTitleSize
 
bool _histogramOwnership
 
bool _objectOwnership
 
bool _usePresetColours
 
bool _allImageFormats
 

Constructor & Destructor Documentation

Plotter::Plotter ( TString  canvasName,
double  width,
double  height 
)

Contruct a plotter with some name, width and height

Definition at line 20 of file Plotter.cpp.

Plotter::Plotter ( const Plotter other)

Copy another plotter - this will hold the same pointers, so make sure that the new plotter doesn't own any of them

Definition at line 61 of file Plotter.cpp.

Member Function Documentation

void Plotter::add ( TObject *  histogram)

add a histogram to the plotter

Definition at line 122 of file Plotter.cpp.

void Plotter::addDot ( double  xpos,
double  ypos,
double  size,
int  colour = 1,
TString  shape = "circle",
double  sizeY = 0.0 
)

add a dot to some point in the canvas

The TString 'shape' can be

  • square (draws a TBox at that (x,y) coord )
  • circle (draws a TEllipse at that (x,y) coord )

Definition at line 134 of file Plotter.cpp.

void Plotter::addObject ( TObject *  obj)

Add an object to the Plotter (e.g. TMarker, TBox...). By default, the plotter takes ownership of the object

Definition at line 168 of file Plotter.cpp.

void Plotter::allImageFormats ( bool  val = true)
inline

If switched on, the plotter will save the canvas to .pdf .png .eps and .C formats (as required by CDS)

Definition at line 83 of file Plotter.h.

TPad* Plotter::getCanvas ( )
inline

Get the canvas

Definition at line 111 of file Plotter.h.

int Plotter::getColor ( int  i)

Get histogram colour i (these are preset)

Definition at line 109 of file Plotter.cpp.

int Plotter::getNumObjects ( )

how many objects have been added to the plotter

Definition at line 103 of file Plotter.cpp.

void Plotter::logX ( bool  log = 1)

use a log scale for the x-axis

Definition at line 152 of file Plotter.cpp.

void Plotter::logY ( bool  log = 1)

use a log scale for the y-axis

Definition at line 157 of file Plotter.cpp.

void Plotter::logZ ( bool  log = 1)

use a log scale for the z-axis

Definition at line 162 of file Plotter.cpp.

void Plotter::scaleAxisTitleOffset ( double  scale)
inline

Scale the title offsets on the axis by a constant factor

Definition at line 128 of file Plotter.h.

void Plotter::scaleAxisTitleSize ( double  scale)
inline

Scale the titles on the axis by a constant factor

Definition at line 122 of file Plotter.h.

void Plotter::scaleTextSize ( double  scale)
inline

Scale the labels and titles on the axis by a constant factor

Definition at line 114 of file Plotter.h.

void Plotter::setBMargin ( double  val)
inline

set the left margin size (as a fracition of the pad width)

Definition at line 158 of file Plotter.h.

void Plotter::setCanvasDefaults ( TPad *  pad)
protectedvirtual

Set defaults on the TCanvas

Definition at line 84 of file Plotter.cpp.

void Plotter::setColor ( int  i,
int  color 
)

Set histogram colour i

Definition at line 93 of file Plotter.cpp.

void Plotter::setHistogramOwnership ( bool  i = 1)
inline

Should I take ownership of the histograms (default is no)

Definition at line 86 of file Plotter.h.

void Plotter::setImageFormat ( TString  format)

Set the image format for all plots to be made

Definition at line 13 of file Plotter.cpp.

void Plotter::setLMargin ( double  val)
inline

set the right margin size (as a fracition of the pad width)

Definition at line 159 of file Plotter.h.

void Plotter::setMax ( double  max)
inline

Set the forced maximum (histograms will be forced to draw with this max)

Definition at line 155 of file Plotter.h.

void Plotter::setMin ( double  min)
inline

Set the forced minimum (histograms will be forced to draw with this min)

Definition at line 153 of file Plotter.h.

void Plotter::setObjectOwnership ( bool  i = 1)
inline

Should I take ownership of the objects (default is yes)

Definition at line 88 of file Plotter.h.

void Plotter::setPropertiesFromTH1 ( TH1 *  hist)

set _xAxisTitleOffset, _yAxisTitleOffset, _xAxisLabelOffset, _yAxisLabelOffset, _xAxisTickLength , _yAxisTickLength , _xAxisLabelSize , _yAxisLabelSize , _xAxisTitleSize , _yAxisTitleSize from the histogram given.

Destructor - delete all the histograms and objects that I own.

Definition at line 172 of file Plotter.cpp.

void Plotter::setRMargin ( double  val)
inline

set the top margin size (as a fracition of the pad width)

Definition at line 160 of file Plotter.h.

void Plotter::setTMargin ( double  val)
inline

set the bottom margin size (as a fracition of the pad width)

Definition at line 161 of file Plotter.h.

void Plotter::setXAxisLabelOffset ( double  val)
inline

set the x-axis label offset

Definition at line 138 of file Plotter.h.

void Plotter::setXAxisLabelSize ( double  val)
inline

set the x-axis label size

Definition at line 134 of file Plotter.h.

void Plotter::setXAxisTickLength ( double  val)
inline

set the x-axis tick length

Definition at line 142 of file Plotter.h.

void Plotter::setXAxisTitleOffset ( double  val)
inline

set the x-axis title offset

Definition at line 140 of file Plotter.h.

void Plotter::setXAxisTitleSize ( double  val)
inline

set the x-axis title size

Definition at line 136 of file Plotter.h.

void Plotter::setYAxisLabelOffset ( double  val)
inline

set the y-axis label offset

Definition at line 139 of file Plotter.h.

void Plotter::setYAxisLabelSize ( double  val)
inline

set the y-axis label size

Definition at line 135 of file Plotter.h.

void Plotter::setYAxisTickLength ( double  val)
inline

set the y-axis tick length

Definition at line 143 of file Plotter.h.

void Plotter::setYAxisTitleOffset ( double  val)
inline

set the y-axis title offset

Definition at line 141 of file Plotter.h.

void Plotter::setYAxisTitleSize ( double  val)
inline

set the y-axis title size

Definition at line 137 of file Plotter.h.

void Plotter::usePresetColours ( bool  val = true)
inline

Should I use the preset colours?

Definition at line 82 of file Plotter.h.

Member Data Documentation

bool Plotter::_allImageFormats
protected

If true, I will save the canvas in all formats when plot() is called

Definition at line 65 of file Plotter.h.

double Plotter::_bMargin
protected

bottom margin size (as a fracition of the pad width)

Definition at line 44 of file Plotter.h.

TPad* Plotter::_canvas
protected

The canvas which add histograms and TObjects are plotted on

Definition at line 33 of file Plotter.h.

std::vector<int> Plotter::_colours
protected

Vector of colours to draw the histograms

Definition at line 39 of file Plotter.h.

double Plotter::_forcedMax
protected

Force a maximum for plotting histograms

Definition at line 35 of file Plotter.h.

double Plotter::_forcedMin
protected

Force a minimum for plotting histogram

Definition at line 36 of file Plotter.h.

bool Plotter::_histogramOwnership
protected

do I own the Histogram pointers given to me?

Definition at line 61 of file Plotter.h.

std::vector<TObject*> Plotter::_histograms
protected

Vector of Histogramss to plot (e.g TH1D or TH2D)

Definition at line 38 of file Plotter.h.

TLegend* Plotter::_legend
protected

The legend (not really implemented yet)

Definition at line 34 of file Plotter.h.

double Plotter::_lMargin
protected

left margin size (as a fracition of the pad width)

Definition at line 41 of file Plotter.h.

bool Plotter::_objectOwnership
protected

do I own the Objects pointers given to me?

Definition at line 62 of file Plotter.h.

std::vector<TObject*> Plotter::_objToPlot
protected

Vector of TObjects to plot (e.g TLine or TMarker)

Definition at line 37 of file Plotter.h.

double Plotter::_rMargin
protected

right margin size (as a fracition of the pad width)

Definition at line 42 of file Plotter.h.

double Plotter::_tMargin
protected

top margin size (as a fracition of the pad width)

Definition at line 43 of file Plotter.h.

bool Plotter::_usePresetColours
protected

Do I use my colour scheme for histograms (true) or the original colours given (false)

Definition at line 64 of file Plotter.h.

double Plotter::_xAxisLabelOffset
protected

x-axis label offset

Definition at line 49 of file Plotter.h.

double Plotter::_xAxisLabelSize
protected

x-axis label size

Definition at line 55 of file Plotter.h.

double Plotter::_xAxisTickLength
protected

x-axis tick length

Definition at line 52 of file Plotter.h.

double Plotter::_xAxisTitleOffset
protected

x-axis title offset

Definition at line 46 of file Plotter.h.

double Plotter::_xAxisTitleSize
protected

x-axis title size

Definition at line 58 of file Plotter.h.

double Plotter::_yAxisLabelOffset
protected

y-axis label offset

Definition at line 50 of file Plotter.h.

double Plotter::_yAxisLabelSize
protected

y-axis label size

Definition at line 56 of file Plotter.h.

double Plotter::_yAxisTickLength
protected

y-axis tick length

Definition at line 53 of file Plotter.h.

double Plotter::_yAxisTitleOffset
protected

y-axis title offset

Definition at line 47 of file Plotter.h.

double Plotter::_yAxisTitleSize
protected

y-axis title size

Definition at line 59 of file Plotter.h.

double Plotter::s_forcedMax = -999.999
static

Force a maximum histogram value for all plotters

Definition at line 75 of file Plotter.h.

double Plotter::s_forcedMin = -999.999
static

Force a minimum histogram value for all plotters

Definition at line 76 of file Plotter.h.

TString Plotter::s_imageformat = ".pdf"
static

Primary image format

Definition at line 71 of file Plotter.h.

TString Plotter::s_imageformat2 = ""
static

Secondary image format

Definition at line 72 of file Plotter.h.

TString Plotter::s_legend_position = "RightTop"
static

Legend positon

Definition at line 73 of file Plotter.h.

int Plotter::s_plotterCount = 0
static

Plotter count (good for making unique names)

Definition at line 74 of file Plotter.h.


The documentation for this class was generated from the following files: