Re: [R] Natural colours for topographic data

2009-11-25 Thread Karl Ove Hufthammer
Tysdag 24. november 2009 11.08.08 skreiv du:
  I would be happy with a simple one, that just mapped negative values
  to water colours and positive values to land colours.

 Have you tried my colourscheme package? Its not on CRAN but you can
get it from here:

Thanks for the suggestion. It looks very nice. Perhaps I’ll even write a 
general function for generating topographic colour scales, based on this.
(It might be a while before it’s ready, though.)

-- 
Karl Ove Hufthammer
http://huftis.org/
Jabber: k...@huftis.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Natural colours for topographic data

2009-11-24 Thread Karl Ove Hufthammer
On Mon, 23 Nov 2009 12:21:03 -0500 David Winsemius 
dwinsem...@comcast.net wrote:
  I would be happy with a simple one, that just mapped negative values  
  to water colours and positive values to land colours.
 
 Searching with the strategy color positive negative zero in r-search  
 and limiting it to r-help replies,  I get this Jim Lemon reply using  
 (naturally) plotrix's color.scale:
 
 http://finzi.psych.upenn.edu/R/Rhelp02/archive/90837.html
 
 The application to your needs looks pretty immediate.

Thanks for the suggestion, but the arguments that 'color.scale' takes 
(range of red, green and blue values) makes it not very useful for this 
purpose.

-- 
Karl Ove Hufthammer

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Natural colours for topographic data

2009-11-24 Thread Barry Rowlingson
On Tue, Nov 24, 2009 at 8:42 AM, Karl Ove Hufthammer k...@huftis.org wrote:
 On Mon, 23 Nov 2009 12:21:03 -0500 David Winsemius
 dwinsem...@comcast.net wrote:
  I would be happy with a simple one, that just mapped negative values
  to water colours and positive values to land colours.

 Searching with the strategy color positive negative zero in r-search
 and limiting it to r-help replies,  I get this Jim Lemon reply using
 (naturally) plotrix's color.scale:

 http://finzi.psych.upenn.edu/R/Rhelp02/archive/90837.html

 The application to your needs looks pretty immediate.

 Thanks for the suggestion, but the arguments that 'color.scale' takes
 (range of red, green and blue values) makes it not very useful for this
 purpose.


 Have you tried my colourscheme package? Its not on CRAN but you can
get it from here:

http://r-forge.r-project.org/projects/colourscheme/

And can be installed thus:
  install.packages(colourschemes,repos=http://r-forge.r-project.org;)

 [sorry about the inconsistency between 'colourscheme' and 'colourschemes'!]

Vignette via r-forge's source code browser:
http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/inst/doc/colourschemes.pdf?rev=19root=colourscheme

 It defines various ways of mapping values to colours and using those
colours in plots. I use topographic-style colour schemes in the
examples, so this might be just what you want. The example in
?multiRamp is this:

# topological colour scheme - water, land, ice:
 tramp = multiRamp(rbind(c(-2000,0),c(0,1000),c(1000,9000)),
  list(c(black,blue),c(green,brown),c(gray70,gray70))
  )

then:

  tramp(-100)
 [1] #F2FF

 - is  a colour between black and blue in the ocean

 tramp(500)
 [1] #539515FF

 - is somewhere between green and brown in the land

  tramp(1500)
 [1] #B3B3B3FF

 - is the gray of the ice.

No logarithmic colour scaling, but I do detail in the vignette how to
write your own colour scheme functions that are compatible with the
ones supplied. Will be glad to help more on this!

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Natural colours for topographic data

2009-11-24 Thread Jim Lemon

On 11/24/2009 07:42 PM, Karl Ove Hufthammer wrote:

On Mon, 23 Nov 2009 12:21:03 -0500 David Winsemius
dwinsem...@comcast.net  wrote:
   

I would be happy with a simple one, that just mapped negative values
to water colours and positive values to land colours.
   

Searching with the strategy color positive negative zero in r-search
and limiting it to r-help replies,  I get this Jim Lemon reply using
(naturally) plotrix's color.scale:

http://finzi.psych.upenn.edu/R/Rhelp02/archive/90837.html

The application to your needs looks pretty immediate.
 

Thanks for the suggestion, but the arguments that 'color.scale' takes
(range of red, green and blue values) makes it not very useful for this
purpose.
   

Hi Karl,
For a start, you could try:

color.scale(oceandepths,extremes=c(lightblue,blue))

for the water and

color.scale(vegetationcover,c(0.55,0),0.55,0)

for the land as really basic natural colors. There are several ways to 
specify the value to color transformations, and you can even overwrite 
some parts of the color matrix using logical vectors, like coloring 
everything over 4000 meters white for snow.


Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Natural colours for topographic data

2009-11-23 Thread Karl Ove Hufthammer
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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Natural colours for topographic data

2009-11-23 Thread David Winsemius


On Nov 23, 2009, at 11:52 AM, Karl Ove Hufthammer wrote:


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.


Searching with the strategy color positive negative zero in r-search  
and limiting it to r-help replies,  I get this Jim Lemon reply using  
(naturally) plotrix's color.scale:


http://finzi.psych.upenn.edu/R/Rhelp02/archive/90837.html

The application to your needs looks pretty immediate.




--
Karl Ove Hufthammer

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.