[R] colorRamp of image to span larger range than dataset
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Mon Sep 6 03:21:22 CEST 2010
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: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Daisy Englert Duursma
Sent: Monday, 6 September 2010 11:05 AM
To: r-help at r-project.org
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
______________________________________________
R-help at 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.
More information about the R-help
mailing list