gsplot.figure.axes_inset#
Functions
|
A functional interface to create an inset axis in a Matplotlib figure. |
|
A functional interface to create an inset axis with padding in a Matplotlib figure. |
- axes_inset(ax, bounds, transform=None, projection=None, polar=False, lab_lims=None, minor_ticks=True, zoom=True, zoom_color='black', zoom_alpha=0.3, zorder=5, **kwargs)[source]#
A functional interface to create an inset axis in a Matplotlib figure.
This function wraps the AxesInset class, allowing inset axes to be created with a simpler function-based interface.
- Parameters:
ax (
Axes
) β The main axis in the figure.bounds (
tuple[float
,float
,float
,float]
) β Bounds for the inset axis in the format (x0, y0, width, height).transform (
Transform | None
, optional) β The transform to apply to the inset axis. Default is None.projection (
str | None
, optional) β The projection type for the inset axis. Default is None.polar (
bool
, defaultFalse
) β If True, the inset axis will use a polar projection.lab_lims (
list[Any] | None
, optional) β Axis labels and limits for the inset axis.minor_ticks (
bool
, defaultTrue
) β Whether to enable minor ticks on the inset axis.zoom (
bool
ortuple[tuple[int
,int]
,tuple[int
,int]]
, defaultTrue
) β Zoom settings for the inset axis.zoom_color (
ColorType
, default'black'
) β Color for the zoom connectors and patches.zoom_alpha (
int | float
, default0.3
) β Transparency for the zoom connectors and patches.zorder (
int | float
, default5
) β The z-order of the inset axis.**kwargs (
Any
) β Additional keyword arguments for label configuration or other customizations.
- Returns:
axins β The created inset axis.
- Return type:
Axes
Notes
zoom provides manual inset zooming when a tuple is provided. zoom = ((1, 2), (3, 4)) will connect the main axis to the inset axis as follows:
1 (main) - 2 (inset)
3 (main) - 3 (inset)
The indices represent the corners of the axes, with 1 being the bottom left corner
Examples
>>> import matplotlib.pyplot as plt >>> fig, ax = plt.subplots() >>> axins = axes_inset(ax, [0.5, 0.5, 0.4, 0.4], lab_lims=["X", "Y", 0, 1, 0, 1]) >>> axins.plot([0, 1], [0, 1])
- axes_inset_padding(ax, width, height, loc='upper right', borderpad=0.5, bbox_to_anchor=None, bbox_transform=None, axes_kwargs=None, lab_lims=None, minor_ticks=True, zoom=True, zoom_color='black', zoom_alpha=0.3, **kwargs)[source]#
A functional interface to create an inset axis with padding in a Matplotlib figure.
This function wraps the AxesInsetPadding class, allowing inset axes to be created with a simpler function-based interface.
- Parameters:
ax (
Axes
) β The parent axis where the inset axis will be placed.loc (
str
, default"upper right"
) β The location of the inset axis relative to the parent axis.borderpad (
float
, default0.5
) β Padding between the parent axis and the inset axis.bbox_to_anchor (
tuple[float
,float] | BboxBase | None
, optional) β Bounding box to anchor the inset axis.bbox_transform (
Transform | None
, optional) β Transformation for the bounding box anchor.axes_kwargs (
dict[str
,Any] | None
, optional) β Additional keyword arguments for the inset axis creation.lab_lims (
list[Any] | None
, optional) β Axis labels and limits for the inset axis.minor_ticks (
bool
, defaultTrue
) β Whether to enable minor ticks on the inset axis.zoom (
bool
ortuple[tuple[int
,int]
,tuple[int
,int]]
, defaultTrue
) β Zoom settings for the inset axis.zoom_color (
ColorType
, default"black"
) β Color for the zoom connectors and patches.zoom_alpha (
int | float
, default0.3
) β Transparency for the zoom connectors and patches.**kwargs (
Any
) β Additional keyword arguments for label configuration or other customizations.
- Returns:
axins β The created inset axis.
- Return type:
Axes
Notes
zoom provides manual inset zooming when a tuple is provided. zoom = ((1, 2), (3, 4)) will connect the main axis to the inset axis as follows:
1 (main) - 2 (inset)
3 (main) - 3 (inset)
The indices represent the corners of the axes, with 1 being the bottom left corner
Examples
>>> import matplotlib.pyplot as plt >>> fig, ax = plt.subplots() >>> axins = axes_inset_padding(ax, "30%", "30%", loc="upper right", zoom=False) >>> axins.plot([0, 1], [0, 1])