Plotting Helper
Namespaces | Functions
plottingHelper.C File Reference
#include "plottingHelper.h"

Namespaces

 PlottingHelper
 The namespace of whole Plotting Helper utility.
 

Functions

void PlottingHelper::PlaceLegends (vector< TLegend * > legs, bool keepRange)
 Setup the position of legends provided in legs array. More...
 
void PlottingHelper::DrawLegends (vector< TLegend * > legs, bool keepRange)
 Draw legends provided in vector legs in such a way that there is no overlap. More...
 
Point PlottingHelper::Abs2Px (Point p, double scaleUp, double scaleDn)
 
Point PlottingHelper::Px2NDC (Point p)
 
void plottingHelper ()
 
Getters

Functions returning elements of the active frame

TH1 * PlottingHelper::GetFrame ()
 The method returns current frame on the active pad. More...
 
TAxis * PlottingHelper::GetXaxis ()
 Return x-axis of the active frame. More...
 
TAxis * PlottingHelper::GetYaxis ()
 Return y-axis of the active frame. More...
 
TAxis * PlottingHelper::GetZaxis ()
 Return z-axis of the active frame. More...
 
Units helpers

Functions to convert units and obtain axis fractions

double PlottingHelper::PxFontToRel (double px)
 Transform font size from px to the relative units. More...
 
double PlottingHelper::RelFontToPx (double rel)
 Transform font size from relative units to pixels. More...
 
double PlottingHelper::GetAxisFractionX ()
 Fraction of the pad width covered by x-axis. More...
 
double PlottingHelper::GetAxisFractionY ()
 Fraction of the pad height covered by y-axis. More...
 
double PlottingHelper::TickAbsToRelX (double tick)
 Convert tick length in px of x-axis to the relative units. More...
 
double PlottingHelper::TickAbsToRelY (double tick)
 Convert tick length in px of y-axis to the relative units. More...
 
Decorators

Functions to simply define text sizes, offsets and axis ticks

void PlottingHelper::SetFonts (double pxX, double pxY, double pxT)
 Set text size of x- and y-axis titles and labels to the frame title. More...
 
void PlottingHelper::SetTicks (double tickX, double tickY)
 Set ticks sizes of x and y-axis in px. More...
 
void PlottingHelper::SetLabelOffsetX (double off)
 Set offset of the x-axis labels. More...
 
void PlottingHelper::SetTitleOffsetX (double off)
 Set offset of the x-axis title. More...
 
void PlottingHelper::SetLabelOffsetY (double off)
 Set offset of the y-axis labels. More...
 
void PlottingHelper::SetTitleOffsetY (double off)
 Set offset of the y-axis title. More...
 
void PlottingHelper::SetFontsTicks (double px, double tickX, double tickY)
 Set of the fonts and ticks sizes. More...
 
void PlottingHelper::SetOffsets (double lX, double tX, double lY, double tY)
 Set offsets of x,y labels and titles. More...
 
void PlottingHelper::SetFTO (vector< double > fonts, vector< double > ticks, vector< double > offsets)
 Set Fonts, Ticks and Offsets. More...
 
Generalized titles

Functions to simplify drawing of latex captions related to the particular frame(s) Especially useful in case of describing complex grid of frames. For captions inside of frame consider also using of automatic legend. Conventional axis titles can be easily "reproduced" with these methods

void PlottingHelper::DrawLatex (TVirtualPad *pad1, TVirtualPad *pad2, double x, double y, TString text, double fSize, TString style)
 Draw latex in coordinates x,y give a hull of two frames in given TPads. More...
 
void PlottingHelper::DrawLatex (TVirtualPad *pad, double x, double y, TString text, double fSize, TString style)
 Draw latex at coordinates of the frame inside the corresponding TPad. More...
 
void PlottingHelper::DrawLatex (double x, double y, TString text, double fSize, TString style)
 Draw latex at coordinates of the frame corresponding to active TPad. More...
 
void PlottingHelper::DrawLatexUp (TVirtualPad *pad1, TVirtualPad *pad2, double Offset, TString text, double fSize, TString style)
 Draw latex up of frame1 and frame2. More...
 
void PlottingHelper::DrawLatexDown (TVirtualPad *pad1, TVirtualPad *pad2, double Offset, TString text, double fSize, TString style)
 Draw latex down of frame1 and frame2. More...
 
void PlottingHelper::DrawLatexRight (TVirtualPad *pad1, TVirtualPad *pad2, double Offset, TString text, double fSize, TString style)
 Draw latex right of frame1 and frame2. More...
 
void PlottingHelper::DrawLatexLeft (TVirtualPad *pad1, TVirtualPad *pad2, double Offset, TString text, double fSize, TString style)
 Draw latex left of frame1 and frame2. More...
 
void PlottingHelper::DrawLatexUp (TVirtualPad *pad, double Offset, TString text, double fSize, TString style)
 Draw latex up of frame corresponding to given pad. More...
 
void PlottingHelper::DrawLatexDown (TVirtualPad *pad, double Offset, TString text, double fSize, TString style)
 Draw latex down of frame corresponding to given pad. More...
 
void PlottingHelper::DrawLatexRight (TVirtualPad *pad, double Offset, TString text, double fSize, TString style)
 Draw latex right of frame corresponding to given pad. More...
 
void PlottingHelper::DrawLatexLeft (TVirtualPad *pad, double Offset, TString text, double fSize, TString style)
 Draw latex left of frame corresponding to given pad. More...
 
void PlottingHelper::DrawLatexUp (double Offset, TString text, double fSize, TString style)
 Draw latex up of frame corresponding to active pad. More...
 
void PlottingHelper::DrawLatexDown (double Offset, TString text, double fSize, TString style)
 Draw latex down of frame corresponding to active pad. More...
 
void PlottingHelper::DrawLatexRight (double Offset, TString text, double fSize, TString style)
 Draw latex right of frame corresponding to active pad. More...
 
void PlottingHelper::DrawLatexLeft (double Offset, TString text, double fSize, TString style)
 Draw latex left of frame corresponding to active pad. More...
 
Auto-legend

Functions to place lagend automaticaly and prevent overlaps

TString PlottingHelper::SetLayout (unsigned pos)
 Convert layout bit to string. More...
 
RectangleNDC PlottingHelper::GetNDC (TLatex *lat)
 Calculates positions and height and width of rectangle which encapsulates TLatex. More...
 
TLegend * PlottingHelper::newLegend (unsigned pos, int nCols)
 Define new legend at position pos with nCols columns. More...
 
void PlottingHelper::GetLegendSizes (TLegend *leg, double &SizeX, double &SizeY, double &SizeYroot)
 Calculates sizes of the legend in NDC. More...
 
Miscellaneous

Utilities for redraw axes, divde pad and auto y-range calculation

void PlottingHelper::UpdateFrame ()
 Redraw the current frame and axis ticks. More...
 
void PlottingHelper::CalcYaxisRange ()
 Calculate the automatic range of the vertical axis and apply it. More...
 
void PlottingHelper::SetLeftRight (double lMargin, double rMargin)
 Set simultaneously left and right margin of active pad. More...
 
void PlottingHelper::SetTopBottom (double tMargin, double bMargin)
 Set simultaneously top and bottom margin of active pad. More...
 
void PlottingHelper::DividePad (vector< double > xDivs, vector< double > yDivs)
 Construct the lattice of pads according to the provided x and y sizes. More...
 
void PlottingHelper::DivideTransparent (vector< double > divX, vector< double > divY, bool useMargins)
 Construct the lattice of frames according to the provided x and y sizes using transparency trick. More...
 
vector< double > PlottingHelper::merge (vector< double > v1, vector< double > v2, vector< double > v3, vector< double > v4, vector< double > v5, vector< double > v6, vector< double > v7)
 Merge vectors into one. More...
 
vector< double > PlottingHelper::repeat (vector< double > x, int n)
 Repeat the provided pattern. More...
 
vector< double > PlottingHelper::group (double frame, double space, int n)
 Construct group of frames. More...
 

Function Documentation

◆ plottingHelper()

void plottingHelper ( )

Definition at line 1780 of file plottingHelper.C.

Variable Documentation

◆ borders

vector<Borders> borders

Definition at line 36 of file plottingHelper.C.

◆ dims

vector<unsigned> dims

Definition at line 31 of file plottingHelper.C.

◆ distToHists

vector<vector<double> > distToHists

Definition at line 33 of file plottingHelper.C.

◆ iSave

int iSave

Definition at line 68 of file plottingHelper.C.

◆ jSave

int jSave

Definition at line 68 of file plottingHelper.C.

◆ last

int last

Definition at line 67 of file plottingHelper.C.

◆ layOuts

vector<vector<pair<int,int> > > layOuts

Definition at line 32 of file plottingHelper.C.

◆ legBorders

vector<vector<Borders> > legBorders

Definition at line 35 of file plottingHelper.C.

◆ minSepar

double minSepar

Definition at line 41 of file plottingHelper.C.

◆ nLeg

int nLeg

Definition at line 30 of file plottingHelper.C.

◆ nSteps

int nSteps = 11

Definition at line 40 of file plottingHelper.C.

◆ pos

unsigned pos

Definition at line 69 of file plottingHelper.C.

◆ recs

vector<Rectangle> recs

Definition at line 19 of file plottingHelper.C.

◆ SizesX

vector<double> SizesX

Definition at line 38 of file plottingHelper.C.

◆ SizesY

vector<double> SizesY

Definition at line 38 of file plottingHelper.C.