[R] Natural colours for topographic data
Karl Ove Hufthammer
karl at huftis.org
Mon Nov 23 17:52:55 CET 2009
Dear list members
I'm currently working on some topographic (elevation) data, and was
somewhat surprised that the 'topo.colors' and 'terrain.colors' are of
little to no use here.
The problem is that these functions only return a palette of colours;
they don't map depth values to colours. So if I plot (using 'image',
'persp' or similar functions) and specify these palettes, ocean areas
may coloured green (indicating) land, which may be quite confusing.
I have looked through various packages, and have found several colour
palette functions, but none that do what I need.
Basically, I just need a function that takes a vector of elevation
values as input, and outputs a vector of 'natural' colours. For negative
values (i.e., ocean), the 'blue' colours of 'topo.colors' would be OK,
and for positive values either the colours of 'terrain.colors' or the
non-blue colours of 'topo.colors' would look nice.
It is of course not very difficult to create such a function myself,
e.g. using the 'cut' function and a standard palette. But perhaps
somebody has already has made one?
My ideal topographic colour mapping function would support separate
colour levels for water and land (so that you can specifiy for example 5
colours of water, from a depth of 5000 meters to 0 meters, and 20
colours of land, from a depth of 0 meters to 2000 meters), support
several nice palettes, and also support logarithmic colour mapping. But
I would be happy with a simple one, that just mapped negative values to
water colours and positive values to land colours.
--
Karl Ove Hufthammer
More information about the R-help
mailing list