MPF.globalStyle module

Some fixed settings to make the plots look nice by default. You can import this module and change some settings if you like - for Example:

import MPF.globalStyle as gst

gst.ratioErrorBandFillStyle = 3354
gst.ratioErrorBandColor = ROOT.kBlack
gst.drawATLASLabel = False

Or better use useOptions which will raise an AttributeError if options are misspelled:

from MPF.globalStyle import useOptions

useOptions(ratioErrorBandFillStyle = 3354,
           ratioErrorBandColor = ROOT.kBlack,
           drawATLASLabel = False)

Alterantively you can also temporarily set options - e.g. for one plot - by using useOptions as a context manager:

from MPF.globalStyle import useOptions

with useOptions(ratioErrorBandFillStyle=3354, ratioErrorBandColor=ROOT.kBlack):
    p.plot("output.pdf")

When TreePlotter is used, a dictionary of globalStyle options can be directly passed to be used in one or multiple plots.

MPF.globalStyle.CMELabelTextSize = 18

Text size for CMELabel

MPF.globalStyle.CMELabelX = 0.352

Default x position for CMELabel

MPF.globalStyle.CMELabelY = 0.83

Default y position for CMELabel

MPF.globalStyle.TLineColor = 1

Default TLine color (not really used yet)

MPF.globalStyle.TLineStyle = 2

Default TLine style (not really used yet)

MPF.globalStyle.TLineWidth = 2

Default TLine width (not really used yet)

MPF.globalStyle.atlasLabelDelX = 0.1

Measure for distance between “ATLAS” and the text

MPF.globalStyle.atlasLabelTextSize = 0.04

Text size for atlasLabel

MPF.globalStyle.atlasLabelX = 0.19

Default x position for atlasLabel

MPF.globalStyle.atlasLabelY = 0.88

Default y position for atlasLabel

MPF.globalStyle.bottomMargin1Pad = None

If given, explicitely set bottom margin in main pad for 1 Pad case

MPF.globalStyle.bottomPadSize3Pad = 0.3

Relative size of the second bottom pad for the splitting with 3 pads

MPF.globalStyle.bottomPadsNoExponent = True

No Exponent on y-axis of bottom pads - this won’t look nice if there are large numbers involved (and no log scale is used), but the exponent doesn’t fit there

MPF.globalStyle.canvasHeight = 600

vertical plot size - changing this might require to change also some other options

MPF.globalStyle.canvasWidth = 800

horizontal plot size - changing this might require to change also some other options

MPF.globalStyle.customTextFont = 43

Font of custom text labels

MPF.globalStyle.customTextSize = 18

Size of custom text labels

MPF.globalStyle.cutLineArrowPos = 0.7

Position of the cutline arrow relative to its height

MPF.globalStyle.cutLineArrows = False

Draw arrows indicating selected region for cut lines

MPF.globalStyle.cutLineColor = 1

TLine color for cut lines

MPF.globalStyle.cutLineHeight = 0.75

Height of cutlines relative to the pad min/max

MPF.globalStyle.cutLineStyle = 2

TLine style for cut lines

MPF.globalStyle.cutLineWidth = 2

TLine width for cut lines

MPF.globalStyle.defaultLogyYmin = 0.1

Default y mininum on log scale plots (in case not explicitely set or automatically determined)

MPF.globalStyle.drawATLASLabel = True

Draw AtlasLabel in plots?

MPF.globalStyle.infoLabelTextSize = 18

Text size for InfoLabel

MPF.globalStyle.infoLabelX = 0.19

Default x position for processLabel

MPF.globalStyle.infoLabelY = 0.78

Default y position for processLabel

MPF.globalStyle.labelFont = 43

Font number for axis and labels (43 is fixed size, atlasStyle default is taken if set to None)

MPF.globalStyle.labelFontSize = 30

Font size for axis and labels (atlasStyle default taken if set to None)

MPF.globalStyle.legendBorderSize = 0

Useful to set this nonzero for debugging

MPF.globalStyle.legendEventCountFormat = ' ({:.1g})'

Format for showing event counts in the legend (if set)

MPF.globalStyle.legendEventCountFormatRaw = ' ({:.0g})'

Format for showing (raw) event counts in the legend (if set)

MPF.globalStyle.legendFont = 42

Legend Font

MPF.globalStyle.legendLongTitleThreshold = 11

Length starting from which a title in the legend is considered long and text will be scaled

MPF.globalStyle.legendShowScaleFactors = True

Show scale factors of processes in legend?

MPF.globalStyle.legendTextSize = 0.04

Default Text size for legend (if None, text will be scaled to fit on legend size)

MPF.globalStyle.legendXMin = 0.7

Legend default x position

MPF.globalStyle.legendYMax = 0.92

Legend default y position

MPF.globalStyle.lumiLabelTextSize = 18

Text size for lumiLabel

MPF.globalStyle.lumiLabelX = 0.19

Default x position for lumiLabel

MPF.globalStyle.lumiLabelY = 0.83

Default y position for lumiLabel

MPF.globalStyle.mainPadSize2Pad = 0.7

Relative size of the mainpad for the splitting with 2 pads

MPF.globalStyle.mainPadSize3Pad = 0.5

Relative size of the mainpad + first bottom pad for the splitting with 3 pads

MPF.globalStyle.mainPadTopMargin = 0.06

Top margin in main pad (relative to absolute canvas height)

MPF.globalStyle.maximumWithErrors = True

Loop over bins to find maximum with errors for histograms

MPF.globalStyle.mergeCMEIntoLumiLabel = False

Only plot a merged Lumi and CME label without “#int L dt” (new ATLAS convention)

MPF.globalStyle.minimumWithErrors = False

Loop over bins to find minimum with errors for histograms

MPF.globalStyle.noLinesForBkg = False

Set true to set LineWidth to 0 for bkg hists (get rid of the black lines in between processes in stack)

MPF.globalStyle.poissonIntervalDataErrors = False

Use the asymmetric 68% poisson interval for drawing data errors

MPF.globalStyle.processLabelTextSize = 18

Text size for the ProcessLabel

MPF.globalStyle.processLabelX = 0.165

Default x position for infoLabel

MPF.globalStyle.processLabelY = 0.96

Default y position for infoLabel

MPF.globalStyle.ratioBottomMargin = 0.4

bottom margin in ratio plots

MPF.globalStyle.ratioErrorBandColor = 796

Color in ratio error bands

MPF.globalStyle.ratioErrorBandFillStyle = 1001

Fill style for ratio error bands

MPF.globalStyle.ratioPadGridy = 1

draw vertical lines on the yAxis ticks of the ratio pad This is used by default for the first bottom pad - assuming it will be some ratio like graph in there (individual plots can overwrite this option)

MPF.globalStyle.ratioPadNDivisions = 504

Axis tick divisions on the ratio pads n = n1 + 100*n2 + 10000*n3

MPF.globalStyle.ratioPlotMainBottomMargin = 0.04

Bottom Margin on the main pad in ratio plots

MPF.globalStyle.ratioXtitleOffset = 3

Ratio xTitle offset

MPF.globalStyle.thankYou = True

Thank MPF at exit of your script

MPF.globalStyle.thirdPadGridy = 1

draw vertical lines on the yAxis ticks of the third bottom pad (individual plots can overwrite this option)

MPF.globalStyle.totalBGErrorColor = <Mock id='140254957442256'>

Color for totalBG error bands

MPF.globalStyle.totalBGFillStyle = 3354

Fill style for totalBG error

MPF.globalStyle.totalBGLineWidth = 3

In case noLinesForBkg is set, the totalBG hist will get a line of this thickness

class MPF.globalStyle.useOptions(optObject=<module 'MPF.globalStyle' from '/home/docs/checkouts/readthedocs.org/user_builds/mpf-plotting/checkouts/latest/pythonpath/MPF/globalStyle.py'>, **kwargs)[source]

Set options of this module. The advantage w.r.t. explicitely setting them is that an AttributeError will be raised if options are misspelled.

Can also be used as a context manager for temporarily setting options.

MPF.globalStyle.xTitleOffset3Pad = 2.4

Ratio xTitle offset

MPF.globalStyle.yTitleOffset = 1.6

default yTitle offset for all pads

MPF.globalStyle.yTitleScale2Pad = 0.9

Scale y-Axis Titles for 3 pad plots

MPF.globalStyle.yTitleScale3Pad = 0.8

Scale y-Axis Titles for 3 pad plots