colorRampPalette returns a function, not a list of colours. You might want to
try something like:
ascols <-
colorRampPalette(c("gray", "yellow", "darkgoldenrod1", "orange", "red"),
interpolate="spline")
x <- 10*(1:nrow(volcano))
y <- 10*(1:ncol(volcano))
image(x, y, volcano, col = ascols(300), axes = FALSE)
### spot the difference...
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Daisy Englert Duursma
Sent: Monday, 6 September 2010 11:05 AM
To: [email protected]
Subject: [R] colorRamp of image to span larger range than dataset
Hello and thanks in advance,
Using the dataset volcano:
ascols =
colorRampPalette(c("gray","yellow","darkgoldenrod1","orange","red"),interpolate="spline")
x <- 10*(1:nrow(volcano))
y <- 10*(1:ncol(volcano))
image(x, y, volcano, col = ascols, axes = FALSE)
In the example above, how would I change my colorRampPalette or image
function so that it would span to 300 even though max(volcano) = 195?
The image I want to make should not return any red because it does not
reach the true maximum possible value which is 300.
Thanks,
Daisy
--
Room E8C156
Dept. Biological Sciences
Macquarie University NSW 2109
Australia
______________________________________________
[email protected] 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.
______________________________________________
[email protected] 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.