Interface to plotting backends#

Available backends#

Matplotlib
Bokeh
Plotly
None (only processing, no plotting)

Common interface arguments#

Common interface to plotting backends.

Each submodule within this module defines a common interface layer to different plotting libraries.

Outside arviz_plots.backend the corresponding backend module is imported, but only the common interface layer is used, making no distinctions between plotting backends. Each submodule inside arviz_plots.backend is expected to implement the same functions with the same call signature. Thus, adding a new backend requires only implementing this common interface for it, with no changes to any of the other modules.

Keyword arguments

The argument names are defined here to have a comprehensive list of all possibilities. If relevant, a keyword argument present here should be present in the function, and converted in each backend to its corresponding argument in that backend.

This set of arguments doesn’t aim to be complete, only to cover basic properties so the plotting functions can work on multiple backends without duplication. Advanced customization will be backend specific through **kwargs.

target

This module is designed mainly in a functional way. Thus, all functions should take a target argument which indicates on which object should the function be applied to.

color

Color of the visual element. Should also be present whenever facecolor and edgecolor are present, setting the default value for both.

facecolor

Color for filling the visual element.

edgecolor

Color for the edges of the visual element.

alpha

Transparency of the visual element.

width

Width of the visual element itself or of its edges, whichever applies.

size

Size of the visual element.

linestyle

Style of the line plotted.

marker

Marker to be added to the plot. Needs to accept | as a valid value.

rotation

Rotation of axis labels in degrees.

vertical_align

Vertical alignment between the visual element and the data coordinates provided.

horizontal_align

Horizontal alignment between the visual element and the data coordinates provided.

axis

Data axis (x, y or both) on which to apply the function.

Common interface functions#

Object creation and I/O#

create_plotting_grid(number[, rows, cols, ...])

Create a figure with a grid of plots in it.

savefig(figure, path, **kwargs)

Show this figure.

show(figure)

Show this figure.

Geoms#

ciliney(x, y_bottom, y_top, target, *[, ...])

Interface to a line from y_bottom to y_top at given value of x.

fill_between_y(x, y_bottom, y_top, target, *)

Fill the region between y_bottom and y_top.

hist(y, l_e, r_e, target, *[, bottom, ...])

Interface to matplotlib for a histogram bar plot.

hline(y, target, *[, color, alpha, width, ...])

Interface to a horizontal line spanning the whole axes.

hspan(ymin, ymax, target, *[, color, alpha])

Interface to a horizontal shaded region spanning the whole axes.

line(x, y, target, *[, color, alpha, width, ...])

Interface to a line plot.

multiple_lines(x, y, target, *[, color, ...])

Interface to multiple lines.

scatter(x, y, target, *[, size, marker, ...])

Interface to a scatter plot.

step(x, y, target, *[, color, alpha, width, ...])

Interface to a step line.

text(x, y, string, target, *[, size, alpha, ...])

Interface to text annotation inside a plot.

vline(x, target, *[, color, alpha, width, ...])

Interface to a vertical line spanning the whole axes.

vspan(xmin, xmax, target, *[, color, alpha])

Interface to a vertical shaded region spanning the whole axes.

Plot appearance#

grid(target, axis, color)

Interface to setting a grid in any axis.

remove_ticks(target, *[, axis])

Interface to removing ticks from a plot.

remove_axis(target[, axis])

Interface to removing axis from a plot.

set_ticklabel_visibility(target, *[, axis, ...])

Interface to setting visibility of tick labels.

set_y_scale(target, scale)

Interface to setting the y scale of a plot.

ticklabel_props(target, *[, axis, size, color])

Interface to setting size of tick labels.

title(string, target, *[, size, color])

Interface to adding a title to a plot.

xlabel(string, target, *[, size, color])

Interface to adding a label to a plot's x axis.

xticks(ticks, labels, target, *[, rotation, ...])

Interface to setting ticks and tick labels of the x axis.

ylabel(string, target, *[, size, color])

Interface to adding a label to a plot's y axis.

yticks(ticks, labels, target, *[, rotation, ...])

Interface to setting ticks and tick labels of the y axis.

Legend#

legend(plot_collection, kwarg_list, label_list)

Generate a legend on a figure given lists of labels and property kwargs.

Helper functions#

get_background_color()

Get the background color of active style.

get_default_aes(aes_key, n[, kwargs])

Generate n default values for a given aesthetics keyword.

scale_fig_size(figsize[, rows, cols, ...])

Scale figure properties according to figsize, rows and cols.