Plotting Helper
|
#include "TCanvas.h"
#include "TROOT.h"
#include "TLatex.h"
#include "TString.h"
#include "TFrame.h"
#include "TLegend.h"
#include "TLegendEntry.h"
#include "TGraph.h"
#include "TMarker.h"
#include "THStack.h"
#include "TMultiGraph.h"
#include "TLine.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <string>
#include <cassert>
Classes | |
struct | PlottingHelper::Rectangle |
Contains coordinates object rectangle envelope. More... | |
struct | PlottingHelper::Point |
struct | PlottingHelper::RectangleNDC |
Struct containing NDC sizes and positions of the corresponding TLatex. More... | |
Namespaces | |
PlottingHelper | |
The namespace of whole Plotting Helper utility. | |
Macros | |
#define | SF TString::Format |
Enumerations | |
enum | { PlottingHelper::kPos1 = BIT(1), PlottingHelper::kPos2 = BIT(2), PlottingHelper::kPos3 = BIT(3), PlottingHelper::kPos4 = BIT(4), PlottingHelper::kPos5 = BIT(5), PlottingHelper::kPos6 = BIT(6), PlottingHelper::kPos7 = BIT(7), PlottingHelper::kPos8 = BIT(8), PlottingHelper::kPos9 = BIT(9), PlottingHelper::kPos2c = BIT(10), PlottingHelper::kPos4c = BIT(11), PlottingHelper::kPos6c = BIT(12), PlottingHelper::kPos8c = BIT(13) } |
Enum with positions which are used for legend placing. More... | |
Functions | |
Point | PlottingHelper::Px2NDC (Point p) |
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) |
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... | |
#define SF TString::Format |
Definition at line 39 of file plottingHelper.h.