graphinglib.SmartFigureWCS.create_twin_axis#

SmartFigureWCS.create_twin_axis(is_y: bool = True, label: str | None = None, axis_lim: tuple[float, float] | None = None, log_scale: bool = False, remove_axes: bool = False, remove_ticks: bool = False, elements: Plottable | Iterable[Plottable | None] = []) SmartTwinAxis#

Creates a twin axis for the SmartFigure. This method creates a SmartTwinAxis object that can be used to plot elements on a secondary axis in the same subplot.

Twin axes can only be created for SmartFigures that currently render as a single plot.

Parameters:
is_ybool, optional

If True, the twin axis will be a y-axis, otherwise it will be an x-axis. Defaults to True.

labelstr, optional

Label for the twin axis.

axis_limtuple[float, float], optional

Limits for the twin axis.

log_scalebool, optional

Whether to use a logarithmic scale for the twin axis. Defaults to False.

remove_axesbool, optional

Whether to remove the axes from the twin axis. Defaults to False.

remove_ticksbool, optional

Whether to remove the ticks from the twin axis. Defaults to False.

elementsPlottable | Iterable[Plottable | None], optional

Elements to plot in the twin axis. A single Plottable is accepted and is treated as a one-element list. If an iterable is provided, any None elements are ignored. Defaults to empty list.

Returns:
SmartTwinAxis

The created twin axis object. The twin axis can also be accessed through the twin_x_axis or twin_y_axis properties.