Function cg = colourgrade_range(v,cg)
returns struct cg with additional fields
defining nice tick values based on the
information in input argument v. The
tick values are stored in cg.gradevalues.
If v is a scalar, vector or matrix of
reals, an ascending series of nice and
easily readable tick values are returned.
If boolean cg.fit is given at input and
it is true, the first and last values in
cg.gradevalues are exactly equal to the
minimal and maximal values in v.
If boolean cg.ordinal is given at input and
it is true, the contents of v is copied into
cg.gradevalues as a one-dimensional
vector.
If v is an cell-array of strings, these
strings form the tick "values". In fact,
cg.gradevalues contains an ascending series
of integers 1, 2, 3, etc. and the contents
of v is copied into cg.gradetexts as a
one-dimensional cell-array of strings.
At input, the struct cg may have the following
optional fields:
cg.fit (boolean; false at default)
cg.ordinal (boolean; false at default)
cg.ntickpref (total preferred number of
ticks; 5 at default)
cg.nsub (number of intervals between
two ticks; 4 at default)
cg.mat2txt (handle to a function for
text representations of an
array of reals)
At output, the struc cg contains new or renewed
fields:
cg.gradevalues (column vector of reals)
cg.gradeticks (column vector of booleans)
cg.gradetexts (column cell-array of strings)
cg.ordinal (boolean; false at default)
The function internally calls the following
non-standard m-files:
colourgrade_init.m
ordreofmagnitude.m
nicerange.m
(c) 2026 fabien van mook
2026.08.20 release of this file within package "fvm-colourgrade" under GNU GPLv3+