graphinglib.SmartFigureWCS.set_ticks#
- SmartFigureWCS.set_ticks(reset: bool = False, x_ticks: list[Quantity] | None = None, y_ticks: list[Quantity] | None = None, x_tick_spacing: Quantity | None = None, y_tick_spacing: Quantity | None = None, number_of_x_ticks: int | None = None, number_of_y_ticks: int | None = None, x_tick_formatter: str | Callable | None = None, y_tick_formatter: str | Callable | None = None, minor_x_tick_frequency: int | None = None, minor_y_tick_frequency: int | 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_tickslist[Quantity], optional
Tick positions for the x or y axis. If a value is specified, the corresponding
x_tick_spacingandnumber_of_x_ticksory_tick_spacingandnumber_of_y_ticksparameters must beNone.- x_tick_spacing, y_tick_spacingQuantity, optional
Spacing between major ticks on the x or y axis. If a value is specified, the corresponding
x_ticksandnumber_of_x_ticksory_ticksandnumber_of_y_ticksparameters must beNone.- number_of_x_ticks, number_of_y_ticksint, optional
Number of ticks to display on the x or y axis. If specified, the
x_ticksandx_tick_spacingory_ticksandy_tick_spacingparameters must beNone.Note
This value is not absolute, but rather a suggestion to the WCSAxes. The actual number of ticks displayed may vary depending on the data and limits of the axes.
- x_tick_formatter, y_tick_formatterstr | Callable, optional
A function or a string format to apply to the x or y tick labels. If a function is provided, it should take a single argument (the tick value) and return a formatted string. If a string is provided, it should be a format string that will be applied to each tick value. See the astropy documentation for more details.
Warning
Callable formatters must only be given if the coordinate axis is not in angular units.
Examples:
>>> x_tick_formatter = "hh:mm:ss.s" ``1h01m34.1s`` >>> x_tick_formatter = lambda x: f"{x:.2f} s" # only for non-angular coordinate axes ``1.23 s``
- minor_x_tick_frequency, minor_y_tick_frequencyfloat, optional
Frequency of minor ticks on the x or y axis. This gives the number of minor ticks between each major tick.
Note
The frequency includes the major tick, so a frequency of 2 means that there is one minor tick between each major tick.
- Returns:
- Self
For convenience, the same SmartFigure with the updated ticks.