[GRASS-user] divergent color tables
Glynn Clements
glynn at gclements.plus.com
Wed Oct 10 00:04:34 EDT 2007
"Carlos \"Guâno\" Grohmann" wrote:
> > > I was wondering if we could have divergent color tables. Say I have a
> > > map of standard deviation, with a very symmetric distribution around
> > > zero. Can I have the same colors diverging from zero? so that +5 and
> > > -5 have the same color?
> >
> > As far as I understand yes you can, set min=blue 0=red max=blue, and it
> > should be symmetrical, provided that min = -1 * max. (I didn't test it,
> > just thinking how it should be).
>
> Yes, I was thinking more as an option for r.colors, maybe ?
Are you referring to a specific colour table, e.g. similar to
color=differences but with the same colour at each end, or an option
to "mirror" any colour table?
The former is trivial; just use a rules file such as:
0% blue
0 red
100% blue
either via rules= or by adding it to $GISBASE/etc/colors/ so that it
becomes an option for color=.
The latter isn't much work to implement, although the specification is
non-trivial.
First, it would need to be decided how to handle the situation where
the range of the data isn't symmetrical about zero. E.g. if you have
an existing colour table:
0% blue
100% red
and the range of the data is -3 to +5, there are three obvious
options:
1. lo => 100%, 0 => 0%, hi => 0%:
-3 red
0 blue
5 red
2. -max(|lo|,|hi|) => 100%, 0 => 0%, max(|lo|,|hi|) => 100%:
-5 red
0 blue
5 red
3. lo => 100%, (lo+hi)/2 => 0%, hi => 100%:
-3 red
1 blue
5 red
Only the last one (centred about the mean) makes sense if the range
doesn't include zero.
There's also the question of how to handle colour tables which are
defined using absolute values (rather than percentages) and the
minimum value isn't zero.
If the minimum value is negative (e.g. etopo2 or terrain), should it
mirror the positive portion of the table about zero (discarding the
negative portion), or the entire table about the minimum value?
If the minimum value is positive, should the table be mirrored about
zero (with the -lo..+lo interval a constant colour) or about the
minimum value?
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list