I can't think of a straightforward way. You might be able to use
the image.plot() function in package fields by using
legend.only=TRUE to add the legend to your existing plot.

 

David

 

From: Morway, Eric [mailto:emorway@usgs.gov] 
Sent: Monday, December 23, 2013 3:46 PM
To: dcarlson@tamu.edu
Cc: R mailing list
Subject: Re: [R] Inserting color into an irregular grid
comprised of polygons

 

Thanks David, 

 

Instead of using terrain.colors or heat.colors, I went with:

 

library(colorRamps)

cv <- matrix(as.integer(cut(vals2, breaks=100)), dim(vals2))

pal <- blue2green2red(100)  #a function from colorRamps

 

Do you happen to have any clever ideas for a legend?  I could
play around with a series of polygons to the side of the plot
(...xpd=TRUE), but don't have any better ideas.  




 

Eric 


	[[alternative HTML version deleted]]

