Function: org--plot/values-stats
org--plot/values-stats is a byte-compiled function defined in
org-plot.el.gz.
Signature
(org--plot/values-stats NUMS &optional HARD-MIN HARD-MAX)
Documentation
Rudimentary statistics about NUMS, useful for guessing axis ticks.
If HARD-MIN or HARD-MAX are set, they will be used instead of the min/max of the NUMS.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-plot.el.gz
(defun org--plot/values-stats (nums &optional hard-min hard-max)
"Rudimentary statistics about NUMS, useful for guessing axis ticks.
If HARD-MIN or HARD-MAX are set, they will be used instead of the min/max
of the NUMS."
(let* ((minimum (or hard-min (apply #'min nums)))
(maximum (or hard-max (apply #'max nums)))
(range (- maximum minimum))
(rangeOrder (if (= range 0) 0
(ceiling (- 1 (log range 10)))))
(range-factor (expt 10 rangeOrder))
(nice-min (if (= range 0) (car nums)
(/ (float (floor (* minimum range-factor))) range-factor)))
(nice-max (if (= range 0) (car nums)
(/ (float (ceiling (* maximum range-factor))) range-factor))))
`(:min ,minimum :max ,maximum :range ,range
:range-factor ,range-factor
:nice-min ,nice-min :nice-max ,nice-max :nice-range ,(- nice-max nice-min))))