spacepy_logo

Previous topic

spacepy.plot.utils.show_used

Next topic

spacepy.plot.utils.timestamp

This Page

spacepy.plot.utils.smartTimeTicks

spacepy.plot.utils.smartTimeTicks(time)[source]

Returns major ticks, minor ticks and format for time-based plots

smartTimeTicks takes a list of datetime objects and uses the range to calculate the best tick spacing and format. Returned to the user is a tuple containing the major tick locator, minor tick locator, and a format string – all necessary to apply the ticks to an axis.

It is suggested that, unless the user explicitly needs this info, to use the convenience function applySmartTimeTicks to place the ticks directly on a given axis.

Parameters:

time : list

list of datetime objects

Returns:

out : tuple

tuple of Mtick - major ticks, mtick - minor ticks, fmt - format