myfigure.myfigure
- class myfigure.myfigure.MyFigure(**kwargs)[source]
Bases:
objectA class for creating and customizing figures using matplotlib and seaborn.
- Variables:
broad_props – Properties applied to all axes.
kwargs – Configuration keyword arguments.
fig – The main figure object from matplotlib.
axs – Axes objects for the subplots.
axts – Twin axes objects, if ‘twinx’ is enabled.
n_axs – Number of axes/subplots.
Initialize a MyFigure object with optional configuration.
- Parameters:
kwargs (Any) – Configuration options as keyword arguments.
- default_kwargs()[source]
Define default keyword arguments for the figure.
- Returns:
Default configuration settings.
- Return type:
Dict[str, Any]
- process_kwargs()[source]
Process and validate keyword arguments.
Raises a ValueError if an invalid keyword argument is provided.
- Return type:
None
- save_figure(filename=None, out_path=None, tight_layout=True, save_as_png=True, save_as_pdf=False, save_as_svg=False, save_as_eps=False, save_as_tif=False, png_transparency=False, dpi=300, update_all_axis_props=True)[source]
Save the figure to a file.
- Parameters:
filename (str | None) – The name of the file.
out_path (pathlib.Path | None) – The path to save the file.
tight_layout (bool) – Whether to use a tight layout.
save_as_png (bool) – Save as PNG.
save_as_pdf (bool) – Save as PDF.
save_as_svg (bool) – Save as SVG.
save_as_eps (bool) – Save as EPS.
png_transparency (bool) – PNG transparency.
- Return type:
None
- myfigure.myfigure.create_inset(ax, x_loc, y_loc, x_lim=None, y_lim=None)[source]
Create an inset plot within an existing axis.
- Parameters:
ax (Axes) – The parent axis.
x_loc (tuple[float, float]) – X location for the inset.
y_loc (tuple[float, float]) – Y location for the inset.
x_lim (tuple[float, float] | None) – X limits for the inset.
y_lim (tuple[float, float] | None) – Y limits for the inset.
- Returns:
The inset axes.
- Return type:
Axes