Skip to content
Snippets Groups Projects
Unverified Commit fc4a28c2 authored by Frank Sauerburger's avatar Frank Sauerburger
Browse files

Define uhepplot interface

parent 98ed180c
Branches 29-menu-doesn-t-work-with-react
No related tags found
1 merge request!56Resolve "Integrate and interface to uhep"
Pipeline #12630 passed
......@@ -55,6 +55,74 @@ class HistogramFactory:
"""
return hist(*self.args, *args, **dict(self.kwds, **kwds))
def uhepplot(dataframe, variable, bins, stacks, selection=None,
range=None, blind=None, axes=None, figure=None,
weight=None, y_log=False, y_min=None, vlines=[],
denominator=0, numerator=-1, ratio_label=None, diff=False,
ratio_range=None, atlas=None, info=None, enlarge=1.6,
density=False, include_outside=False, **kwds):
"""
Creates a histogram of stacked processes. The first argument is the
dataframe to operate on. The 'variable' argument defines the x-axis. The
variable argument can be a Variable object or a string naming a column in
the dataframe.
The 'bins' argument can be an integer specifying the number of bins or a
list with all bin boundaries. If it is an integer, the argument range is
mandatory. The range argument must be a tuple with the lowest and highest
bin edge. The properties of a Variable object are used for the x- and
y-axis labels.
Stacks must be Stack objects. The plotting style is defined via the stack
object.
The optional blind argument controls which stack should be blinded. The
argument can be a single stack, a list of stacks or None. By default,
no stack is blinded.
If the figure argument is omitted, this method creates a new axes and
figure. If axes only is omitted, the method creates a new axes from the
figure. If a ratio plot is drawn, axes must a list if main, ratio plot if
not omitted.
The method returns (figure, axes) which were used during plotting. This
might be identical to the figure and axes arguments. If a ratio plot is
drawn, the axes return value is a list of main, ratio plot.
The weight is used to weight the entries. Entries have unit
weight if omitted. The argument can be a string name of a column or a
variable object.
If the y_log argument is set to True, the y axis will be logarithmic. The
axis is enlarged on a logarithmic scale to make room for the ATLAS labels.
The optional y_min argument can be used to set the lower limit of the y
axis. The default is 0 for linear scale, and 1 for logarithmic scale.
The option vlines can be used to draw vertical lines onto the histogram,
e.g., a cut line. The argument should be an array, one item for each line.
If the item is a number a red line will be drawn at that x-position. If it
is a dict, it will take the item 'x' to determine the position, all other
keywords are passed to matplotlibs plot method.`
The ratio_label option controls the label of the ratio plot.
The ratio_range argument control the y-range of the ratio plot. If set to
None, it will scale automatically to include all points. The default is
is None.
If diff is set to True, The difference between the 'numerator' and the
'denominator' is down instead of their ratio.
The module constants ATLAS and INFO are passed to atlasify. Overwrite them
to change the badges.
If the density argument is True, the area of each stack is normalized to
unity.
The method returns a Universal HEP plot object.
"""
def hist(dataframe, variable, bins, stacks, selection=None,
range=None, blind=None, axes=None, figure=None,
weight=None, y_log=False, y_min=None, vlines=[],
......
......@@ -11,3 +11,4 @@ lxml
keras
tensorflow
dask[complete]
git+https://gitlab.cern.ch/fsauerbu/uhepplot.git
......@@ -25,6 +25,7 @@ setup(name='nnfwtbn',
"keras",
"dask",
"dask[complete]",
"uhepplot",
"lxml"],
test_suite='nnfwtbn.tests',
description='Experimental neural network framework to be named.',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment