ogstools.plot.levels module#
Utilities to create nicely spaced levels.
- ogstools.plot.levels.nice_num(val)[source]#
Return the closest number of the form 10**x * {1,2,4,5}.
Fractions containing only these number are ensured to have terminating decimal representations.
- Return type:
float
- ogstools.plot.levels.nice_range(lower, upper, n_ticks)[source]#
Return an array in the interval (lower, upper) with terminating decimals.
The length of the arrays will be close to n_ticks.
- Return type:
ndarray
- ogstools.plot.levels.adaptive_rounding(vals, precision)[source]#
Return the given values rounded to significant digits.
The significant digits are based of the median decimal exponent and the given precision.
- Return type:
ndarray
- ogstools.plot.levels.compute_levels(lower, upper, n_ticks)[source]#
Return an array in the interval [lower, upper] with terminating decimals.
The length of the arrays will be close to n_ticks. At the boundaries the tickspacing may differ from the remaining array.
- Return type:
ndarray
- ogstools.plot.levels.median_exponent(vals)[source]#
Get the median exponent from an array of numbers.
- Return type:
int