[R] How can I map numbers to colours with raster?
Jonsson
amen.alyaari at Bordeaux.inra.fr
Mon Oct 29 10:13:29 CET 2012
This code will read binary file and display it as a map. may problem is that
this code is using a continuous colour scheme, even though I have discrete
data (which is a classification scheme). How can I map numbers to colours
with raster? Please
require(raster)
conne <- file("C:\\lai.bin", "rb")
sd<- readBin(conne, integer(), size=1, n=360*720, signed=F)
y<-t(matrix((data=sd), ncol=360, nrow=720))
r = raster(y)
extent(r) = extent(c(xmn=-180,xmx=180,ymn=-90,ymx=90))
plot(r)
--
View this message in context: http://r.789695.n4.nabble.com/How-can-I-map-numbers-to-colours-with-raster-tp4647742.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list