DiscreteLocator

class DiscreteLocator(locs, **kwargs)[source]

Bases: Locator

A tick locator suitable for discretized colorbars. Adds ticks to some subset of the location list depending on the available space determined from get_tick_space. Zero will be used if it appears in the location list, and step sizes along the location list are restricted to “nice” intervals by default.

Parameters
  • locs (array-like) – The tick location list.

  • nbins (int, optional) – Maximum number of ticks to select. By default this is automatically determined based on the the axis length and tick label font size.

  • minor (bool, default: False) – Whether this is for “minor” ticks. Setting to True will select more ticks with an index step that divides the index step used for “major” ticks.

  • steps (array-like of int, default: [1 2 3 4 5 6 8]) – Valid integer index steps when selecting from the tick list. Must fall between 1 and 9. Powers of 10 of these step sizes will also be permitted.

  • vcenter (float, optional) – The optional non-zero center of the original diverging normalizer.

  • min_n_ticks (int, default: 1) – The minimum number of ticks to select. See also nbins.

Methods Summary

__call__()

Return the locations of the ticks.

set_params([nbins, minor, steps, vcenter, ...])

Set the parameters for this locator.

tick_values(vmin, vmax)

Return the locations of the ticks.