graphinglib.SmartTwinAxis.set_ticks#
- SmartTwinAxis.set_ticks(reset: bool = False, ticks: Iterable[float] | None = None, tick_labels: Iterable[str] | Callable[[float], str] | None = None, tick_spacing: float | None = None, minor_ticks: Iterable[float] | None = None, minor_tick_spacing: float | None = None) Self[source]#
Sets custom ticks and tick labels.
- Parameters:
- resetbool, optional
If
True, resets all previously set ticks to their default values before applying the new parameters. Defaults toFalse.- ticksIterable[float], optional
Tick positions for the axis. If a value is specified, the
tick_spacingparameter must beNone.- tick_labelsIterable[str] | Callable[[float], str], optional
Tick labels for the axis. Can be either:
An iterable of strings: If a value is specified, the
ticksparameter must also be given. The number of tick labels must match the number of ticks.A callable that takes a float (the tick position) and returns a string: Can be used with
ticksto apply the function to each tick position, or withtick_spacingto apply the function to any tick position using a custom formatter.
- tick_spacingfloat, optional
Spacing between major ticks on the axis. When a callable
tick_labelsis provided with spacing, the callable will be used to format all tick labels automatically.- minor_ticksIterable[float], optional
Minor tick positions for the axis.
- minor_tick_spacingfloat, optional
Spacing between minor ticks on the axis.
- Returns:
- Self
For convenience, the same SmartTwinAxis with the updated ticks.