[R-sig-Geo] Transparency of Raster* objects
Robert Hijmans
r.hijmans at gmail.com
Thu Jul 28 23:40:36 CEST 2011
Pierre,
There are two ways. You can use the alpha argument in plot, or in a function
that generates a vector of colors, see below. But note that this works in
the previous and in the next version of raster, but in the current version
only with 'oldstyle=TRUE'.
>From ?slopeAspect
library(raster)
dem <- getData('alt', country='CHE')
slas <- slopeAspect(dem)
hill <- hillShade(slas[[1]], slas[[2]], 40, 270)
plot(hill, col=grey(0:100/100), legend=FALSE, main='Switzerland')
plot(dem, col=rainbow(25, alpha=0.35), add=TRUE)
plot(hill, col=grey(0:100/100), legend=FALSE, main='Switzerland')
plot(dem, col=rainbow(25), alpha=0.35, add=TRUE)
# for the current version, use oldstyle=T
plot(hill, col=grey(0:100/100), legend=FALSE, main='Switzerland')
plot(dem, col=rainbow(25, alpha=0.35), add=TRUE, oldstyle=T)
Robert
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Transparency-of-Raster-objects-tp6628801p6631467.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list