shnitsel.vis.plot.common#
Functions#
|
Adds a label just outside the top left corner of a plot (outside the axes). |
|
Helper function to add a text label inside of the axes to ax. |
|
Create figure and axes-object if an axes-object is not supplied. |
|
Calculate the endpoint of extrusion of the point (x,y) from point (0,0) until it intersects either x or y boundary. |
|
Helper function to display an image from a bytestream input, e.g. an encoded png in axes. |
|
Helper function to plot an SVG image represented by its str representation into |
Module Contents#
- outlabel(ax, label)#
Adds a label just outside the top left corner of a plot (outside the axes).
- Parameters:
ax (Axes) – The
Axesobject to annotatelabel (str) – The label to be added
- Return type:
The
matplotlib.text.Textinstance created
- inlabel(ax, label)#
Helper function to add a text label inside of the axes to ax.
- Parameters:
ax (Axes) – The
Axesobject to annotatelabel (str) – The label to be added
- Return type:
The
matplotlib.text.Annotationinstance created representing the inserted label.
- figax(fig=None, ax=None)#
Create figure and axes-object if an axes-object is not supplied.
- Parameters:
fig (Figure | SubFigure | None, optional) – The optional figure to use as a basis for ax if the latter is not provided. Defaults to None.
ax (Axes | None, optional) – The axes object provided. Will be used to populate fig if provided.. Defaults to None.
- Returns:
A complete combination of figure and axes.
- Return type:
tuple[Figure | SubFigure, Axes]
- extrude(x, y, xmin, xmax, ymin, ymax)#
Calculate the endpoint of extrusion of the point (x,y) from point (0,0) until it intersects either x or y boundary.
- Parameters:
x (float) – Coordinates of the vector to extrapolate
y (float) – Coordinates of the vector to extrapolate
xmin (float) – Bounds of the rectangle to the edge of which the ray should be extended
xmax (float) – Bounds of the rectangle to the edge of which the ray should be extended
ymin (float) – Bounds of the rectangle to the edge of which the ray should be extended
ymax (float) – Bounds of the rectangle to the edge of which the ray should be extended
- Returns:
The position at the end of the extrusion, where the origin-ray through (x,y) intersects the boundary of the axes.
- Return type:
- mpl_imshow_png(ax, png, **imshow_kws)#
Helper function to display an image from a bytestream input, e.g. an encoded png in axes.
Removes axes labels from ax.
- Parameters:
ax (Axes) – The
Axesobject into which to plotpng (bytes) – The bytestream data of the image to plot
- Return type:
AxesImage, as returned byax.imshow
- mpl_svg_into_axes(ax, svg_string, chord_length=0.01)#
Helper function to plot an SVG image represented by its str representation into provided Axes.
Used to plot SVG graphics into a set of axes instead of a pixelated PNG.
- Parameters:
- Return type:
Axes, after the plotting of