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 vertical interval line at a given x position.

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

Fill the region between two y-values.

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

Interface to a histogram bar plot.

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

Interface to a horizontal reference line.

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

Interface to a horizontal shaded region.

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

Interface to a line plot.

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

Interface to multiple line plots.

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

Interface to a scatter plot.

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

Interface to a step line plot.

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

Interface to a text annotation inside a plot.

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

Interface to a vertical reference line.

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

Interface to a vertical shaded region.

Plot appearance#

grid(target, axis, color)

Interface to a grid.

remove_ticks(target, *[, axis])

Interface to removing ticks from a plot.

remove_axis(target[, axis])

Interface to removing an axis from a plot.

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

Interface to setting tick label visibility.

set_y_scale(target, scale)

Interface to setting the y-axis scale of a plot.

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

Interface to tick label properties.

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

Interface to a title.

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

Interface to an x-axis label.

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

Interface to x-axis ticks.

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

Interface to a y-axis label.

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

Interface to y-axis ticks.

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.