Reputation: 739
I have a raster file that i want show the places of the sites I used in this map. I wonder if you have help here:
library(rasterVis)
r <- raster(nrow=10, ncol=10)
r[] = 1
r[51:100] = 3
r[3:6, 1:5] = 5
r <- ratify(r)
rat <- levels(r)[[1]]
rat$landcover <- c('Pine', 'Oak', 'Meadow')
rat$class <- c('A1', 'B2', 'C3')
levels(r) <- rat
levelplot(r, col.regions=c('palegreen', 'midnightblue', 'indianred1'))
I want to show the place where lat = 50 and long=100. just to put a circle or square in this point on the map.
Upvotes: 2
Views: 503
Reputation: 93851
The following code will add a single point at lat=50, lon=100:
levelplot(r, col.regions=c('palegreen', 'midnightblue', 'indianred1')) +
layer(panel.points(100,50, pch=21, cex=3, colour='black', fill='red'))
pch
sets the marker type (see ?pch
for the various marker types), cex
controls the size.
Upvotes: 4