[R] Color index in image function

Bernardo Rangel Tura tura at centroin.com.br
Thu Sep 10 12:47:32 CEST 2009


On Wed, 2009-09-09 at 02:33 -0700, FMH wrote:
> Thank you for the hints, but how could i add the grid lines which have numbers, representing the height of the volcano on the image.
> 
> Thank you
> 

So I think this script  is what you need


Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue"))
require(fileds)
image.plot(volcano, col = Brazilan.Pallete(50), axes = FALSE) 
contour(volcano, levels = seq(90, 200, by = 5), add = TRUE)

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil


> 
> 
> ----- Original Message ----
> From: Bernardo Rangel Tura <tura at centroin.com.br>
> To: FMH <kagba2006 at yahoo.com>
> Sent: Tuesday, September 8, 2009 10:14:07 AM
> Subject: Re: [R] Color index in image function
> 
> On Mon, 2009-09-07 at 07:59 -0700, FMH wrote:
> > Thank you for the tips. I have manage to run your script, but  was still never get the way to include the color index beside the image which could explain the intensity of the color from the lower index(green) to the higher index(blue). This color index might be represented by  an increasing of color index in another table beside the image, started from green followed by green-yellow, yellow, yellow-blue and blue?
> > 
> > Could someone please advice on this matter?
> > 
> > Cheers
> > Fir
> > 
> 
> Hi FHM,
> 
> Well If you desire one color index in a imageplot  I don't know solve
> your problem.
> 
> But in your scirptyou use image and 
> 
> image(x, y, volcano, col = terrain.colors(100), axes = FALSE)
> contour(x, y, volcano, levels = seq(90, 200, by = 5),
>         add = TRUE, col = "peru")
> 
> In this case I suggest you use 
> 
> Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue"))
> filled.contour(volcano, color = Brazilan.Pallete)

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil




More information about the R-help mailing list