fluopy.figure¶
A universal figure to plot simulation results.
A universal figure is defined for plotting simulation results with matplotlib.
Functions¶
|
Constructs a figure or modifies axes. |
Module Contents¶
- fluopy.figure.universal_figure(nrows: int = 1, ncols: int = 1, fig_width: float = 6, fig_height: float = 3, scale: float = 1, rc_linewidth: float = 2, type_: str = 'line', data: numpy.typing.ArrayLike | collections.abc.Sequence[Any] = (0, 0), label: str | collections.abc.Sequence[str] | None = None, color: str | collections.abc.Sequence[str] | collections.abc.Callable[[int]] = 'blue', title: str | None = None, xlabel: str = 'x', ylabel: str = 'y', ylabelcolor: str = 'black', xlim: tuple[float, float] | None = None, ylim: tuple[float, float] | None = None, xscale: str | None = None, yscale: str | None = None, xminor: bool = False, yminor: bool = False, adjust_x: float | None = None, adjust_y: float | None = None, xticks: numpy.typing.ArrayLike | None = None, yticks: numpy.typing.ArrayLike | None = None, xticklabels: dict[str, Any] | None = None, yticklabels: dict[str, Any] | None = None, tick_params: dict[str, Any] | None = None, tick_spacing_x: float | None = None, tick_spacing_y: float | None = None, tick_style_x: str | None = None, tick_style_y: str | None = None, second_axis_x: bool = False, second_axis_y: bool = False, fontsize: float = 21, legend: bool = False, legendhandles: collections.abc.Sequence[Any] | None = None, legendcolor: str = 'black', legendargs: dict[str, Any] | None = None, draw_marker: collections.abc.Sequence[Any] | None = None, draw_marker_param: dict[str, Any] | None = None, plot_distribution: scipy.stats.distributions.rv_frozen | collections.abc.Sequence[scipy.stats.distributions.rv_frozen] | None = None, plot_distribution_label: str | None = None, axes: numpy.typing.NDArray[matplotlib.axes.Axes] | None = None, **type_specific_kwargs: Any) numpy.typing.NDArray[matplotlib.axes.Axes][source]¶
Constructs a figure or modifies axes.
- Parameters:
nrows – Number of rows of plt.subplots.
ncols – Number of columns of plt.subplots.
fig_width – Width of the figure.
fig_height – Height of the figure.
scale – Factor to scale the figure.
rc_linewidth – Linewidth of the axes.
type – Type of the plot. One of “hist”, “multiple_hist”, “2d_hist”, “bar”, “line”, “multiple_line”, “scatter”, “errorbar”, “step”, “stair”, “boxplot”.
data – Data to be plotted. Required formation depends on input parameter type_.
label – Label to pass to legend. For multiple_line, multiple_hist, and bar, a list of labels.
color – Color. For multiple_line and multiple_hist, either a callable function or a list of colors. For bar, a color or a list of colors.
title – The title of the plot.
xlabel – The label text of the x-axis.
ylabel – The label text of the y-axis.
ylabelcolor – The color of the y-axis label.
xlim – Left and right limit of the x-axis.
ylim – Lower and upper limit of the y-axis.
xscale – One of “linear”, “log”, “symlog”, “logit”.
yscale – One of “linear”, “log”, “symlog”, “logit”.
xminor – Whether to plot minor ticks on the x-axis. Only relevant if xscale is log.
yminor – Whether to plot minor ticks on the y-axis. Only relevant if yscale is log.
adjust_x – Factor applied to tick label formatter.
adjust_y – Factor applied to tick label formatter.
xticks – xtick locations.
yticks – ytick locations.
xticklabels – Keyword ‘labels’ with labels to place at the given tick locations. Keyword ‘rotation’ to rotate text.
yticklabels – Keyword ‘labels’ with labels to place at the given tick locations. Keyword ‘rotation’ to rotate text.
tick_params – Parameters to pass to .tick_params().
tick_spacing_x – Set a tick on each integer multiple of tick_spacing_x.
tick_spacing_y – Set a tick on each integer multiple of tick_spacing_y.
tick_style_x – “sci” - scientific notation. The offset is added to the xlabel.
tick_style_y – “sci” - scientific notation. The offset is added to the ylabel.
second_axis_x – Whether to plot a second x-axis.
second_axis_y – Whether to plot a second y-axis.
fontsize – Size of font.
legend – Whether to display a legend.
legendhandles – If not None, collection of handles (e.g., matplotlib.patches.Patch).
legendcolor – Color of text in legend.
legendargs – Additional arguments to pass to legend.
draw_marker – The data positions, consists of x and y.
draw_marker_param – Parameters to pass to .scatter. Default is {“marker”: “x”, “c”: “k”, “label”: “prediction”, “s”: 100}.
plot_distribution – Additional distribution to be plotted. For multiple_hist, a list of distributions.
plot_distribution_label – Label of plot_distribution. For multiple_hist, label is ‘pred’.
axes – Contains matplotlib.axes.Axes objects. If None, a new figure is created.
type_specific_kwargs – type_ properties
- Returns:
Contains matplotlib.axes.Axes. Shape is (nrows, ncols).
- Return type:
npt.NDArray[matplotlib.axes.Axes]