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 to False.

x_ticks, y_ticksIterable[float], optional

Tick positions for the x or y axis. If a value is specified, the corresponding x_tick_spacing or y_tick_spacing parameter must be None.

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_ticks or y_ticks parameter 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_ticks or y_ticks to apply the function to each tick position, or with x_tick_spacing or y_tick_spacing to 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_ticks or y_ticks parameter must be None. When a callable x_tick_labels or y_tick_labels is 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_spacing or minor_y_tick_spacing parameter must be None.

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_ticks or minor_y_ticks parameter must be None.

Returns:
Self

For convenience, the same SmartFigure with the updated ticks.