piel.visual.plot.basic#
Attributes#
Functions#
|
Plot a simple line graph. This function abstracts the basic plotting functionality |
|
Plot multiple rows of files on separate subplots, sharing the same x-axis. |
|
Plot multiple (x_data, y_data) pairs on separate subplots, similar to plot_simple. |
Module Contents#
- logger#
- plot_simple(x_data: numpy.ndarray, y_data: numpy.ndarray, label: str | None = None, ylabel: str | piel.types.Unit | None = None, xlabel: str | piel.types.Unit | None = None, fig: Any | None = None, axs: List[Any] | None = None, title: str | None = None, plot_args: list = None, plot_kwargs: dict = None, figure_kwargs: dict = None, legend_kwargs: dict = None, title_kwargs: dict = None, xlabel_kwargs: dict = None, ylabel_kwargs: dict = None, *args, **kwargs) tuple[source]#
Plot a simple line graph. This function abstracts the basic plotting functionality while keeping the flexibility of the matplotlib library, allowing customization of labels, titles, and figure properties.
- Parameters:
x_data (np.ndarray) – Data for the X-axis.
y_data (np.ndarray) – Data for the Y-axis.
label (Optional[str], optional) – Label for the plot line, useful for legends. Defaults to None.
ylabel (str | Unit | None, optional) – Label for the Y-axis, or a Unit object with a label and base attribute. Defaults to None.
xlabel (str | Unit | None, optional) – Label for the X-axis, or a Unit object with a label and base attribute. Defaults to None.
fig (Optional[Any], optional) – Matplotlib Figure object to be used. Defaults to None.
axs (Optional[List[Any]], optional) – List of Matplotlib Axes objects. Defaults to None.
title (Optional[str], optional) – Title of the plot. Defaults to None.
plot_args (list, optional) – Positional arguments passed to plt.plot(). Defaults to None.
plot_kwargs (dict, optional) – Keyword arguments passed to plt.plot(). Defaults to None.
figure_kwargs (dict, optional) – Keyword arguments for figure creation. Defaults to None.
legend_kwargs (dict, optional) – Keyword arguments for legend customization. Defaults to None.
title_kwargs (dict, optional) – Keyword arguments for title customization. Defaults to None.
xlabel_kwargs (dict, optional) – Keyword arguments for X-axis label customization. If ‘show’ is set to False, the X-axis label will not be displayed. Defaults to None.
ylabel_kwargs (dict, optional) – Keyword arguments for Y-axis label customization. If ‘show’ is set to False, the Y-axis label will not be displayed. Defaults to None.
*args – Additional positional arguments for plt.plot().
**kwargs – Additional keyword arguments for plt.plot().
- Returns:
The figure and axes of the plot.
- Return type:
Tuple[plt.Figure, plt.Axes]
- plot_simple_multi_row(data: pandas.DataFrame, x_axis_column_name: str = 't', row_list: List[str] | None = None, y_label: List[str] | None = None, x_label: str | None = None, titles: List[str] | None = None, subplot_spacing: float = 0.15) Any[source]#
Plot multiple rows of files on separate subplots, sharing the same x-axis.
- Parameters:
data (pd.DataFrame) – Data to plot.
x_axis_column_name (str, optional) – Column name of the x-axis. Defaults to “t”.
row_list (Optional[List[str]], optional) – List of column names to plot. Defaults to None.
y_label (Optional[List[str]], optional) – List of Y-axis titles for each subplot. Defaults to None.
x_label (Optional[str], optional) – Title of the x-axis. Defaults to None.
titles (Optional[List[str]], optional) – Titles for each subplot. Defaults to None.
subplot_spacing (float, optional) – Spacing between subplots. Defaults to 0.3.
- Returns:
The matplotlib figure containing the subplots.
- Return type:
plt.Figure
- plot_simple_multi_row_list(data: list[tuple[numpy.ndarray, numpy.ndarray]], labels: List[str | None] | None = None, y_labels: List[str | None] | None = None, x_label: str | None = None, titles: List[str | None] | None = None, fig: Any | None = None, axs: List[Any] | None = None, plot_args: List[List[Any]] | None = None, plot_kwargs: List[dict[str, Any]] | None = None, figure_kwargs: dict[str, Any] | None = None, legend_kwargs: dict[str, Any] | None = None, title_kwargs: dict[str, Any] | None = None, subplot_spacing: float = 0.15, *args, **kwargs) tuple[Any, List[Any]][source]#
Plot multiple (x_data, y_data) pairs on separate subplots, similar to plot_simple.
- Parameters:
data (List[Tuple[np.ndarray, np.ndarray]]) – List of tuples containing x and y data.
labels (Optional[List[Optional[str]]], optional) – List of labels for each plot. Defaults to None.
y_labels (Optional[List[Optional[str]]], optional) – List of Y-axis labels for each subplot. Defaults to None.
x_label (Optional[str], optional) – Common X-axis label for all subplots. Defaults to None.
titles (Optional[List[Optional[str]]], optional) – List of titles for each subplot. Defaults to None.
fig (Optional[plt.Figure], optional) – Matplotlib figure. If None, a new figure is created. Defaults to None.
axs (Optional[List[plt.Axes]], optional) – List of Matplotlib axes. If None, new axes are created. Defaults to None.
plot_args (Optional[List[List[Any]]], optional) – List of positional arguments for each plot. Defaults to None.
plot_kwargs (Optional[List[dict[str, Any]]], optional) – List of keyword arguments for each plot. Defaults to None.
figure_kwargs (Optional[dict[str, Any]]], optional) – Keyword arguments for figure creation. Defaults to None.
legend_kwargs (Optional[dict[str, Any]]], optional) – Keyword arguments for legends. Defaults to None.
title_kwargs (Optional[dict[str, Any]]], optional) – Keyword arguments for titles. Defaults to None.
subplot_spacing (float, optional) – Spacing between subplots. Defaults to 0.15.
*args – Additional positional arguments passed to plt.plot().
**kwargs – Additional keyword arguments passed to plt.plot().
- Returns:
The figure and list of axes of the plot.
- Return type:
Tuple[plt.Figure, List[plt.Axes]]