1 #ifndef __plottingHelper__ 2 #define __plottingHelper__ 10 #include "TLegendEntry.h" 14 #include "TMultiGraph.h" 39 #define SF TString::Format 46 double fX,
fY, fWidth, fHeight;
52 Point(
double _x,
double _y): x(_x), y(_y) {}
94 void SetFonts(
double pxX,
double pxY = -1,
double pxT = -1);
95 void SetTicks(
double tickX,
double tickY = -1);
100 void SetFontsTicks(
double px,
double tickX,
double tickY = -1.);
101 void SetOffsets(
double lX,
double tX,
double lY,
double tY);
102 void SetFTO(vector<double> fonts, vector<double> ticks, vector<double> offsets);
105 void DrawLatex(TVirtualPad *pad1, TVirtualPad *pad2,
double x,
double y, TString text,
double fSize=-1.0, TString style=
"");
106 void DrawLatex(TVirtualPad *pad,
double x,
double y, TString text,
double fSize=-1.0, TString style=
"");
107 void DrawLatex(
double x,
double y, TString text,
double fSize=-1.0, TString style=
"");
109 void DrawLatexUp(TVirtualPad *pad1, TVirtualPad *pad2,
double Offset, TString text,
double fSize=-1.0, TString style=
"");
110 void DrawLatexDown(TVirtualPad *pad1,TVirtualPad *pad2,
double Offset, TString text,
double fSize=-1.0, TString style=
"");
111 void DrawLatexRight(TVirtualPad *pad1, TVirtualPad *pad2,
double Offset, TString text,
double fSize=-1.0, TString style=
"");
112 void DrawLatexLeft(TVirtualPad *pad1, TVirtualPad *pad2,
double Offset, TString text,
double fSize=-1.0, TString style=
"");
114 void DrawLatexUp(TVirtualPad *pad,
double Offset, TString text,
double fSize=-1.0, TString style=
"");
115 void DrawLatexDown(TVirtualPad *pad,
double Offset, TString text,
double fSize=-1.0, TString style=
"");
116 void DrawLatexRight(TVirtualPad *pad,
double Offset, TString text,
double fSize=-1.0, TString style=
"");
117 void DrawLatexLeft(TVirtualPad *pad,
double Offset, TString text,
double fSize=-1.0, TString style=
"");
119 void DrawLatexUp(
double Offset, TString text,
double fSize=-1.0, TString style=
"");
120 void DrawLatexDown(
double Offset, TString text,
double fSize=-1.0, TString style=
"");
121 void DrawLatexRight(
double Offset, TString text,
double fSize=-1.0, TString style=
"");
122 void DrawLatexLeft(
double Offset, TString text,
double fSize=-1.0, TString style=
"");
134 double fX,
fY, fWidth, fHeight;
143 void GetLegendSizes(TLegend *leg,
double &SizeX,
double &SizeY,
double &SizeYroot);
144 void PlaceLegends(vector<TLegend*> legs,
bool keepRange =
false);
145 void DrawLegends(vector<TLegend*> legs,
bool keepRange=
false);
155 void DividePad(vector<double> xDivs, vector<double> yDivs);
156 void DivideTransparent(vector<double> divX, vector<double> divY,
bool useMargins =
true);
157 vector<double>
merge(vector<double> v1, vector<double> v2={}, vector<double> v3={}, vector<double> v4={}, vector<double> v5={}, vector<double> v6={}, vector<double> v7={} );
158 vector<double>
repeat(vector<double> x,
int n);
159 vector<double>
group(
double frame,
double space,
int n);
TAxis * GetZaxis()
Return z-axis of the active frame.
double GetAxisFractionX()
Fraction of the pad width covered by x-axis.
double TickAbsToRelY(double tick)
Convert tick length in px of y-axis to the relative units.
double GetAxisFractionY()
Fraction of the pad height covered by y-axis.
TAxis * GetYaxis()
Return y-axis of the active frame.
TAxis * GetXaxis()
Return x-axis of the active frame.
double RelFontToPx(double rel)
Transform font size from relative units to pixels.
void SetLabelOffsetX(double off)
Set offset of the x-axis labels.
void CalcYaxisRange()
Calculate the automatic range of the vertical axis and apply it.
void PlaceLegends(vector< TLegend *> legs, bool keepRange=false)
Setup the position of legends provided in legs array.
void DrawLatexUp(TVirtualPad *pad1, TVirtualPad *pad2, double Offset, TString text, double fSize=-1.0, TString style="")
Draw latex up of frame1 and frame2.
void DivideTransparent(vector< double > divX, vector< double > divY, bool useMargins=true)
Construct the lattice of frames according to the provided x and y sizes using transparency trick...
void SetLeftRight(double lMargin, double rMargin)
Set simultaneously left and right margin of active pad.
void SetOffsets(double lX, double tX, double lY, double tY)
Set offsets of x,y labels and titles.
void SetFonts(double pxX, double pxY=-1, double pxT=-1)
Set text size of x- and y-axis titles and labels to the frame title.
void DividePad(vector< double > xDivs, vector< double > yDivs)
Construct the lattice of pads according to the provided x and y sizes.
vector< double > group(double frame, double space, int n)
Construct group of frames.
vector< double > repeat(vector< double > x, int n)
Repeat the provided pattern.
void SetFontsTicks(double px, double tickX, double tickY=-1.)
Set of the fonts and ticks sizes.
void UpdateFrame()
Redraw the current frame and axis ticks.
void SetTopBottom(double tMargin, double bMargin)
Set simultaneously top and bottom margin of active pad.
The namespace of whole Plotting Helper utility.
double TickAbsToRelX(double tick)
Convert tick length in px of x-axis to the relative units.
Point Abs2Px(Point p, double scaleUp, double scaleDn)
void DrawLatexRight(TVirtualPad *pad1, TVirtualPad *pad2, double Offset, TString text, double fSize=-1.0, TString style="")
Draw latex right of frame1 and frame2.
void SetFTO(vector< double > fonts, vector< double > ticks, vector< double > offsets)
Set Fonts, Ticks and Offsets.
vector< double > 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.
Contains coordinates object rectangle envelope.
void SetTitleOffsetX(double off)
Set offset of the x-axis title.
void SetLabelOffsetY(double off)
Set offset of the y-axis labels.
void DrawLegends(vector< TLegend *> legs, bool keepRange=false)
Draw legends provided in vector legs in such a way that there is no overlap.
void SetTicks(double tickX, double tickY=-1)
Set ticks sizes of x and y-axis in px.
TString SetLayout(unsigned pos)
Convert layout bit to string.
void DrawLatexDown(TVirtualPad *pad1, TVirtualPad *pad2, double Offset, TString text, double fSize=-1.0, TString style="")
Draw latex down of frame1 and frame2.
void DrawLatexLeft(TVirtualPad *pad1, TVirtualPad *pad2, double Offset, TString text, double fSize=-1.0, TString style="")
Draw latex left of frame1 and frame2.
void SetTitleOffsetY(double off)
Set offset of the y-axis title.
Point(double _x, double _y)
TLegend * newLegend(unsigned pos, int nCols=1)
Define new legend at position pos with nCols columns.
RectangleNDC GetNDC(TLatex *lat)
Calculates positions and height and width of rectangle which encapsulates TLatex. ...
Struct containing NDC sizes and positions of the corresponding TLatex.
double PxFontToRel(double px)
Transform font size from px to the relative units.
TH1 * GetFrame()
The method returns current frame on the active pad.
void GetLegendSizes(TLegend *leg, double &SizeX, double &SizeY, double &SizeYroot)
Calculates sizes of the legend in NDC.
void DrawLatex(TVirtualPad *pad1, TVirtualPad *pad2, double x, double y, TString text, double fSize=-1.0, TString style="")
Draw latex in coordinates x,y give a hull of two frames in given TPads.