UI module¶
User interface.
-
physicslab.ui.
plot_grid
(df, plot_value, fig_axs=None, skip=None, title=None, xlabel=None, ylabel=None, row_labels=True, column_labels=True, subplots_adjust_kw=None, **kwargs)[source]¶ Construct a figure with the same layout as the input.
For example, use it to display SEM images, where rows correspond to different magnifications and columns to samples.To display all figures, callshow()
.- Parameters
df (pandas.DataFrame) – Data to drive plotting. E.g. filename to load and plot
plot_value (callable) –
Function to convert a
df
value intoax.plot
.def plot_value(ax: matplotlib.axes.Axes, value: object): ax.plot(value.x) ax.legend() # Show a legend for each plot.
fig_axs (tuple(Figure, numpy.ndarray(Axes)), optional) – Figure and axis array to draw to. Axis shape must match that of
df
. If None, create a new figure, defaults to Noneskip (list, optional) – Skip df values matching any of the listed items, defaults to None
title (str, optional) – Common title. If
auto
, usedf.name
if available, defaults to Nonexlabel (str, optional) – Common x axis label, defaults to None
ylabel (str, optional) – Common y axis label, defaults to None
row_labels (bool, optional) – Annotate rows by
df.index
, defaults to Truecolumn_labels (bool, optional) – Annotate columns by
df.columns
, defaults to Truesubplots_adjust_kw (dict, optional) – Dict with keywords passed to the
subplots_adjust()
call. E.g.hspace
, defaults to Nonekwargs – All additional keyword arguments are passed to the
figure()
call. E.g.sharex
- Raises
ValueError – If
df
andaxs
have different shapes- Returns
Same objects as from
matplotlib.pyplot.subplots()
- Return type