graphinglib.SmartTwinAxis#
- class graphinglib.SmartTwinAxis(label: str | None = None, axis_lim: tuple[float, float] | None = None, log_scale: bool = False, remove_axes: bool = False, remove_ticks: bool = False, invert_axis: bool = False, elements: Plottable | Iterable[Plottable | None] = [])[source]#
This class implements a twin axis for the
SmartFigureandSmartFigureWCSclasses.Behaves like a
SmartFigureobject, but is not meant to be used on its own. Elements can be added to the twin axis using theadd_elements()method and the same methods as for theSmartFigureclass can be used to customize the twin axis.- Parameters:
- 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.- invert_axisbool, optional
Whether to invert the twin axis. Defaults to
False.- elementsPlottable | Iterable[Plottable | None], optional
Elements to plot in the twin axis. A single
Plottableis accepted and is treated as a one-element list. If an iterable is provided, anyNonevalues are ignored. See theelementsparameter of theSmartFigureclass for more details.
Methods
__init__([label, axis_lim, log_scale, ...])add_elements(*elements)Adds one or more
Plottableelements to the twin axis.copy()Returns a deep copy of the
SmartTwinAxisobject.copy_with(**kwargs)Returns a deep copy of the SmartTwinAxis with specified attributes overridden.
set_rc_params([rc_params_dict, reset])Customize the visual style of the
SmartTwinAxis.set_tick_params([which, reset, direction, ...])Sets the tick parameters.
set_ticks([reset, ticks, tick_labels, ...])Sets custom ticks and tick labels.
set_visual_params([reset, edge_color, ...])Customize the visual style of the twin axis.
__iter__()Iterates over the elements in the SmartTwinAxis in order of their position in the grid, from top-left to bottom-right.
__len__()Gives the number of elements in the
SmartTwinAxis.__getitem__(key)Gives the element(s) at the specified key in the SmartTwinAxis's list of elements.