graphinglib.SmartFigure.set_ticks#
- SmartFigure.set_ticks(reset: bool = False, x_ticks: Iterable[float] | None = None, y_ticks: Iterable[float] | None = None, x_tick_labels: Iterable[str] | Callable | None = None, y_tick_labels: Iterable[str] | Callable | None = None, x_tick_spacing: float | None = None, y_tick_spacing: float | None = None, minor_x_ticks: Iterable[float] | None = None, minor_y_ticks: Iterable[float] | None = None, minor_x_tick_spacing: float | None = None, minor_y_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.- x_ticks, y_ticksIterable[float], optional
Tick positions for the x or y axis. If a value is specified, the corresponding
x_tick_spacingory_tick_spacingparameter must beNone.- x_tick_labels, y_tick_labelsIterable[str] | Callable, optional
Tick labels for the x or y axis. Can be either:
An iterable of strings: If a value is specified, the corresponding
x_ticksory_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
x_ticksory_ticksto apply the function to each tick position, or withx_tick_spacingory_tick_spacingto apply the function to any tick position using a custom formatter.
- x_tick_spacing, y_tick_spacingfloat, optional
Spacing between major ticks on the x or y axis. If a value is specified, the corresponding
x_ticksory_ticksparameter must beNone. When a callablex_tick_labelsory_tick_labelsis provided with a spacing parameter, the callable will be used to format all tick labels automatically.- minor_x_ticks, minor_y_ticksIterable[float], optional
Minor tick positions for the x or y axis. If a value is specified, the corresponding
minor_x_tick_spacingorminor_y_tick_spacingparameter must beNone.- minor_x_tick_spacing, minor_y_tick_spacingfloat, optional
Spacing between minor ticks on the x or y axis. If a value is specified, the corresponding
minor_x_ticksorminor_y_ticksparameter must beNone.
- Returns:
- Self
For convenience, the same SmartFigure with the updated ticks.