jpt.plotting.engines.plotly_engine

Classes

PlotlyRendering

Abstract supertype of distribution rendering engines. Instantiating this class with the engine parameter will

Module Contents

class jpt.plotting.engines.plotly_engine.PlotlyRendering

Bases: jpt.plotting.engines.rendering.DistributionRendering

Abstract supertype of distribution rendering engines. Instantiating this class with the engine parameter will overriding this class’s __new__ method and automatically create an instance of the respective subclass.

plot_multinomial(dist: Any, title: str = None, fname: str = None, directory: str = '/tmp', view: bool = False, horizontal: bool = False, max_values: int = None, alphabet: bool = False, color: str = 'rgb(15,21,110)', xvar: str = None, **kwargs)

Generates a horizontal (if set) otherwise vertical bar plot representing the variable’s distribution.

Parameters:
  • title – the title of the plot. defaults to the type of this distribution, can be left empty by passing False.

  • fname – the name of the file to be stored. Available file formats: png, svg, jpeg, webp, html

  • directory – the directory to store the generated plot files

  • view – whether to display generated plots, default False (only stores files)

  • horizontal – whether to plot the bars horizontally, default is False, i.e. vertical bars

  • max_values – maximum number of values to plot

  • alphabet – whether the bars are sorted in alphabetical order of the variable names. If False, the bars are sorted by probability (descending); default is False

  • color – the color of the plot traces; accepts str of form: * rgb(r,g,b) with r,g,b being int or float * rgba(r,g,b,a) with r,g,b being int or float, a being float * #f0c (as short form of #ff00cc) or #f0cf (as short form of #ff00ccff) * #ff00cc * #ff00ccff

Returns:

plotly.graph_objs.Figure

plot_numeric(dist: Any, title: str | bool = None, fname: str = None, xlabel: str = 'value', directory: str = '/tmp', view: bool = False, color: str = 'rgb(15,21,110)', fill: str = None, **kwargs)

Generates a plot of the piecewise linear function representing the variable’s cumulative distribution function

Parameters:
  • title – the title of the plot. defaults to the type of this distribution, can be left empty by passing False.

  • fname – the name of the file to be stored. Available file formats: png, svg, jpeg, webp, html

  • xlabel – the label of the x-axis

  • directory – the directory to store the generated plot files

  • view – whether to display generated plots, default False (only stores files)

  • color – the color of the plot traces; accepts str of form: * rgb(r,g,b) with r,g,b being int or float * rgba(r,g,b,a) with r,g,b being int or float, a being float * #f0c (as short form of #ff00cc) or #f0cf (as short form of #ff00ccff) * #ff00cc * #ff00ccff

Returns:

plotly.graph_objs.Figure

plot_integer(dist: Any, title: str = None, fname: str = None, directory: str = '/tmp', view: bool = False, horizontal: bool = False, max_values: int = None, alphabet: bool = False, color: str = 'rgb(15,21,110)', **kwargs)

Generates a horizontal (if set) otherwise vertical bar plot representing the variable’s distribution.

Parameters:
  • title – the name of the variable this distribution represents

  • fname – the name of the file to be stored. Available file formats: png, svg, jpeg, webp, html

  • directory – the directory to store the generated plot files

  • view – whether to display generated plots, default False (only stores files)

  • horizontal – whether to plot the bars horizontally, default is False, i.e. vertical bars

  • max_values – maximum number of values to plot

  • alphabet – whether the bars are sorted in alphabetical order of the variable names. If False, the bars are sorted by probability (descending); default is False

  • color – the color of the plot traces; accepts str of form: * rgb(r,g,b) with r,g,b being int or float * rgba(r,g,b,a) with r,g,b being int or float, a being float * #f0c (as short form of #ff00cc) or #f0cf (as short form of #ff00ccff) * #ff00cc * #ff00ccff

Returns:

plotly.graph_objs.Figure

plot_multivariate(dist: Any, title: str = None, fname: str = None, directory: str = '/tmp', pdf: bool = False, view: bool = False, **kwargs)
plot_gaussian(dist: Any, title: str | bool = None, fname: str = None, xlabel: str = '$x$', ylabel: str = None, dim: int = 3, precision: int = 2, directory: str = '/tmp', view: bool = False, color: str = 'rgb(15,21,110)', fill: str = None, **kwargs)

Generates a plot of the piecewise linear function representing the variable’s cumulative distribution function

Parameters:
  • title – the title of the plot. defaults to the type of this distribution, can be left empty by passing False.

  • fname – the name of the file to be stored. Available file formats: png, svg, jpeg, webp, html

  • xlabel – the label of the x-axis

  • directory – the directory to store the generated plot files

  • view – whether to display generated plots, default False (only stores files)

  • color – the color of the plot traces; accepts str of form: * rgb(r,g,b) with r,g,b being int or float * rgba(r,g,b,a) with r,g,b being int or float, a being float * #f0c (as short form of #ff00cc) or #f0cf (as short form of #ff00ccff) * #ff00cc * #ff00ccff

Returns:

plotly.graph_objs.Figure