shnitsel.vis.datasheet.figures.common#

Functions#

label_plot_grid(fig, *[, row_headers, col_headers, ...])

Helper function to add labels to rows and columns of a grid of suplots

figaxs_defaults(mosaic[, scale_factors, height_ratios])

Decorator to automatically create a mosaic of subfigures and provide the axes to the decorated function if only a figure is provided.

centertext(text, ax[, clearticks, background_color, color])

Helper method to center the text within the axes.

Module Contents#

label_plot_grid(fig, *, row_headers=None, col_headers=None, row_pad=1, col_pad=5, rotate_row_headers=True, **text_kwargs)#

Helper function to add labels to rows and columns of a grid of suplots

Parameters:
  • fig (Figure | SubFigure) – The figure holding the subgrid to label

  • row_headers (list[str], optional) – List of labels for rows. Defaults to None.

  • col_headers (list[str], optional) – List of labels for columns. Defaults to None.

  • row_pad (int, optional) – Padding applied to the rows. Defaults to 1.

  • col_pad (int, optional) – Padding applied to the columns. Defaults to 5.

  • rotate_row_headers (bool, optional) – Flag to rotate the Row labels by 90 degrees. Defaults to True.

figaxs_defaults(mosaic, scale_factors=None, height_ratios=None)#

Decorator to automatically create a mosaic of subfigures and provide the axes to the decorated function if only a figure is provided.

Parameters:
  • mosaic (list[HashableList[Hashable]]) – Matrix of keys, where the individual subplots should go

  • scale_factors (Sequence[float], optional) – Sequence of scale factors for the individual plots. Defaults to None.

  • height_ratios (Sequence[float], optional) – Height ratios of the individual plots. Defaults to None.

centertext(text, ax, clearticks='y', background_color=None, color=None)#

Helper method to center the text within the axes.

Optionally removes ticks in the dimensions x or y.

Parameters:
  • text (str) – Message to center in the frame

  • ax (Axes) – Axes to plot the text into

  • clearticks (str, optional) – String of all dimensions to clear the ticks for (may contain x and/or y). Defaults to ‘y’.

  • background_color (ColorType|None, optional) – Color argument to set for the background of the plot

  • color (ColorType|None, optional) – Color argument to set for font on the plot

Returns:

The Text object created by a call to .text() on the ax object.

Return type:

Text