netsa.data.nice — “Nice” Numbers for Chart Bounds

A set of functions to produce ranges of aesthetically-pleasing numbers that have the specified length and include the specified range. Functions are provided for producing nice numeric and time-based ranges.

netsa.data.nice.nice_ticks(lo : num, hi : num[, ticks=5, inside=False]) → num, num, num iter

Find ‘nice’ places to put ticks tick marks for numeric data spanning from lo to hi. If inside is True, then the nice range will be contained within the input range. If inside is False, then the nice range will contain the input range. To find nice numbers for time data, use nice_time_ticks.

The result is a tuple containing the minimum value of the nice range, the maximum value of the nice range, and an iterator over the tick marks.

See also nice_ticks_seq.

netsa.data.nice.nice_ticks_seq(lo : num, hi : num[, ticks=5, inside=False]) → num seq

A convenience wrapper of nice_ticks to return the nice range as a sequence.

netsa.data.nice.nice_time_ticks(lo : datetime, hi : datetime[, ticks=5, inside=False, as_datetime=True]) → datetime/int, datetime/int, datetime/int iter

Find ‘nice’ places to put ticks tick marks for time data spanning from lo to hi. If inside is True, then the nice range will be contained within the input range. If inside is False, then the nice range will contain the input range. To find nice numbers for numerical data, use nice_ticks.

The result is a tuple containing the minimum value of the nice range, the maximum value of the nice range, and an iterator over the ticks marks. If as_datetime is True, the result values will be datetime.datetime objects. Otherwise, the result values will be numbers of seconds since UNIX epoch. Regardless, the return value is expressed in UTC.

See also nice_time_ticks_seq.

netsa.data.nice.nice_time_ticks_seq(lo : datetime, hi : datetime[, ticks=5, inside=False, as_datetime=True]) → datetime/int seq

A convenience wrapper of nice_time_ticks to return the nice range as a sequence.