Skip to content
Prev 21998 / 29559 Next

Question on histograms from Raster and RasterVIS packages

Here is an example, with the mean in dotted red line and the median in
dotted blue line:


library(rasterVis)

f <- system.file("external/test.grd", package="raster")
r <- raster(f)

mn <- cellStats(r, mean)
md <- cellStats(r, median)

histogram(r) + layer(panel.abline(v = mn, col = "red", lty = 2)) +
layer(panel.abline(v = md, col = "blue", lty = 2))
On Wed, Nov 19, 2014 at 2:56 AM, Nuno S? <nunocesardesa at gmail.com> wrote: