MPL_Figure#

class vispipe.plot_backend.MPL_Figure(id=None, fig=None, ax=None, subplots=None, title=None, layout='compressed', figsize=None, subplots_kw={}, legend=False)#

Matplotlib backend used by vispipe.

Parameters:
  • id (int | str, optional) – Identifier for the figure. Will be used in the future.

  • fig (matplotlib.figure.Figure | None, default=None) – A matplotlib figure. If fig==None and ax==None plt.subplots() is called .

  • ax (Axes | Iterable | None, default=None) – Axes or collection of Axes.

  • subplots (tuple[int,int], optional) – If not None, it is unpacked and used for nrows and ncols for plt.subplots().

  • title (str, optional) – If not None, it will be used by self._fig.suptitle(title).

  • layout ({'constrained', 'compressed', 'tight', 'none', LayoutEngine, None}, default='compressed') – Layout of self._fig.

  • figsize (tuple[float,float] | None, default=None) – Used for figsize plt.subplots().

  • subplots_kw (dict, optional) – Other keyword arguments used by plt.subplots().

  • legend (bool | dict, optional) – Toggles legends for the plot. The keyword argument label must be passed to the plot, otherwise the legend is ignored. If a dict is passed then legend is used as keyword arguments for ax.legend().

property figure#

The Figure used for the plot.

property subfigs#

The Axes for the plot.

gca()#

Returns the current axis being used.

Return type:

Axes

sca(ax)#

Sets the the provided axis to be the current axis.

return_fig()#

Returns the the figure and the axes.

Return type:

tuple[Figure, ndarray]

Plotters#

Built in plotting methods.

line(points, *args[, T, ax])

Calls ax.plot()

scatter(points, *args[, T, ax])

Calls ax.scatter()

triplot(*meshdata[, bbox, ax])

Call ax.triplot()

contour(vals, mesh[, bbox, fill, limits, ...])

Calls ax.contour() or ax.contourf().

tricontour(vals, *meshdata[, bbox, fill, ...])

Calls ax.tricontour() or ax.tricontourf().

hist(vals, bins[, cmap, valsrange, ...])

Calls ax.hist().

Figure Options#

Methods for changing The figure parameters.

get_title()

Returns the title of the figure as a str.

set_title(t, **kwargs)

Sets the title of the figure.

get_subtitle([ax])

Gets the title of an axis.

set_subtitle(label[, loc, pad, y, ax])

Sets the lable for an axis.

get_xlabel([ax])

Returns the label of the xaxis of the current or specified axis.

set_xlabel(xlabel[, labelpad, loc, ax])

Sets the label of the xaxis.

get_ylabel([ax])

Returns the label of the yaxis of the current or specified axis.

set_ylabel(ylabel[, labelpad, loc, ax])

Sets the label of the yaxis.

set_xticks(xticks[, labels, minor, ax])

Sets the xticks.

set_yticks(yticks[, labels, minor, ax])

Sets the yticks.

set_aspect(aspect[, adjustable, anchor, ...])

Sets relative spacing of y to x data.

set_grid([visible, which, axis, ax])

Sets grid lines for the axis

get_bbox([ax])

Returns the xlim and ylim of the axis.

set_bbox(bbox[, ax])

Sets the xlim and ylim of the plot.

set([ax])

Calls ax.set()

link_subplots(ax1, *ax2[, sharex, sharey])

cbar(mappable[, cax, ax, label, label_kwargs])

Calls plt.colorbar().

savefig(path[, dpi])

Calls fig.savefig().