Plotting

There are different plotting backends supported:

  • matplotlib (default, de-facto standard plotting library in python),
  • ROOT (the library used by CERN people),
  • bokeh (open-source package with interactive plots)
class rep.plotting.AbstractPlot[source]

Bases: object

Abstract class for possible plot objects, which implements plot function.

plot(new_plot=False, xlim=None, ylim=None, title=None, figsize=None, xlabel=None, ylabel=None, fontsize=None, show_legend=True, grid=True)[source]

Plot data using matplotlib library. Use show() method for matplotlib to see result or

%matplotlib inline

in IPython to see plot as cell output.

Parameters:
  • new_plot (bool) – create or not new figure
  • xlim (None or tuple(x_min, x_max)) – x-axis range
  • ylim (None or tuple(y_min, y_max)) – y-axis range
  • title (None or str) – title
  • figsize (None or tuple(weight, height)) – figure size
  • xlabel (None or str) – x-axis name
  • ylabel (None or str) – y-axis name
  • fontsize (None or int) – font size
  • show_legend (bool) – show or not labels for plots
  • grid (bool) – show grid or not
plot_bokeh(xlim=None, ylim=None, title=None, figsize=None, xlabel=None, ylabel=None, fontsize=None, show_legend=True)[source]

Plot data using bokeh library. Use show() method for bokeh to see result.

Parameters:
  • xlim (None or tuple(x_min, x_max)) – x-axis range
  • ylim (None or tuple(y_min, y_max)) – y-axis range
  • title (None or str) – title
  • figsize (None or tuple(weight, height)) – figure size
  • xlabel (None or str) – x-axis name
  • ylabel (None or str) – y-axis name
  • fontsize (None or int) – font size
  • show_legend (bool) – show or not labels for plots
plot_tmva(new_plot=False, style_file=None, figsize=None, xlim=None, ylim=None, title=None, xlabel=None, ylabel=None, show_legend=True)[source]

Plot data using tmva library.

Parameters:
  • new_plot (bool) – create or not new figure
  • style_file (None or str) – tmva styles configuring file
  • xlim (None or tuple(x_min, x_max)) – x-axis range
  • ylim (None or tuple(y_min, y_max)) – y-axis range
  • title (None or str) – title
  • figsize (None or tuple(weight, height)) – figure size
  • xlabel (None or str) – x-axis name
  • ylabel (None or str) – y-axis name
  • show_legend (bool) – show or not labels for plots
class rep.plotting.BarComparePlot(data, alpha=0.5, sortby=None, step=5)[source]

Bases: rep.plotting.AbstractPlot

Implements bar plots

Parameters:
  • data (dict[str, dict(str, float)]) –
  • alpha (float) – opacity
  • sortby (None or str) – sort bars by this data key
  • step (int) – length
class rep.plotting.BarPlot(data, bins=30, normalization=True, value_range=None)[source]

Bases: rep.plotting.AbstractPlot

Implements bar plots

Parameters:
  • data (dict[str, tuple(array, array, str)]) – name - value, weight, style (‘filled’, another)
  • bins (int or list[float]) – bins for histogram
  • normalization (bool) – normalize to pdf histogram or not
  • value_range (None or tuple) – min and max values
class rep.plotting.ColorMap(matrix, labels=None, cmap='jet', vmin=-1, vmax=1)[source]

Bases: rep.plotting.AbstractPlot

Implements color map plots

Parameters:
  • matrix (numpy.ndarray) – matrix
  • labels (None or list[str]) – names for each matrix-row
  • cmap (str) – color map name
  • vmin (float) – min value for color map
  • vmax (float) – max value for color map
class rep.plotting.CorrelationMapPlot(data, bins=30)[source]

Bases: rep.plotting.AbstractPlot

Implements correlations map plots

Parameters:
  • array) data ((array,) – name var, name var - values for first, values for second
  • bins (int or list[float]) – count of bins
class rep.plotting.CorrelationPlot(data, bins=30)[source]

Bases: rep.plotting.AbstractPlot

Implements correlations plots

Parameters:
  • array) data ((array,) – values for first, values for second
  • bins (int or list[float]) – count of bins
class rep.plotting.ErrorPlot(errors, size=2, log=False)[source]

Bases: rep.plotting.AbstractPlot

Implements error bars plots

Parameters:
  • errors (dict[str, tuple(array, array, array, array)]) – name - x points, y points, y errors, x errors
  • size (int) – size of scatters
  • log (bool) – logarithm scaling
class rep.plotting.Function2D_Plot(function, xlim, ylim, xsteps=100, ysteps=100, cmap='Blues', vmin=None, vmax=None)[source]

Bases: rep.plotting.AbstractPlot

Implements 2d-functions plots

Parameters:
  • function (function) – vector function (X, Y)
  • float) xlim (tuple(float,) – x ranges
  • float) ylim (tuple(float,) – y ranges
  • xsteps (int) – count of points for approximation on x-axis
  • ysteps (int) – count of points for approximation on y-axis
  • cmap (str) – color map
  • vmin (float) – value, corresponding to minimum on cmap
  • vmax (float) – value, corresponding to maximum on cmap
class rep.plotting.FunctionsPlot(functions)[source]

Bases: rep.plotting.AbstractPlot

Implements 1d-function plots

Parameters:functions (dict[str, tuple(array, array)]) – dict which maps label of curve to x, y coordinates of points
class rep.plotting.GridPlot(columns=3, *plots)[source]

Bases: rep.plotting.AbstractPlot

Implements grid of plots (set of plots organized in a grid).

Parameters:
  • columns (int) – count of columns in grid
  • plots (list[AbstractPlot]) – plot objects
class rep.plotting.HStackPlot(*plots)[source]

Bases: rep.plotting.AbstractPlot

Horizontal stack of plots.

Parameters:plots (list[AbstractPlot]) – plot objects
class rep.plotting.Histogram2D_Plot(data, bins=30, cmap='Blues', cmin=None, cmax=None, range=None, normed=False)[source]

Bases: rep.plotting.AbstractPlot

Implements correlations plots

Parameters:
  • array) data ((array,) – name var, name var - values for first, values for second
  • bins (int or list[float]) – count of bins
  • cmap (str) – color map
  • cmin (float) – value, corresponding to minimum on cmap
  • cmax (float) – value, corresponding to maximum on cmap
  • normed (bool) – normalize histogram
  • range – array_like shape(2, 2), optional, default: None [[xmin, xmax], [ymin, ymax]]. All values outside of this range will be considered outliers and not tallied in the histogram.
class rep.plotting.ScatterPlot(scatters, alpha=0.1, size=20)[source]

Bases: rep.plotting.AbstractPlot

Implements scatters plots

Parameters:
  • scatters (dict[str, tuple(array, array)]) – name - x points, y points
  • size (int) – scatters size
  • alpha (float) – transparency
class rep.plotting.VStackPlot(*plots)[source]

Bases: rep.plotting.AbstractPlot

Implements vertical stack plots

Parameters:plots (list[AbstractPlot]) – plot objects
rep.plotting.canvas(name='canvas1', size=(800, 600))[source]

Helper method for creating canvas If canvas with this name already exists, it will be returned