Closed lime-n closed 4 years ago
Again, this is more of a general spatial R questions, but the idea is you either need to:
xlim
and ylim
arguments to the sf plot function, see ?sf::plot
# set up plot area
plot(bcr, col = NA, border = NA)
I found that the mistake was at the beginning of the book, which is easily corrected and may have been a simple miss when writing the code.
when reading the bcr code at the beginning:
> bcr <- read_sf("data/gis-data.gpkg", "bcr") %>%
st_transform(crs = map_proj) %>%
st_geometry()
It is best to include:
filter(bcr_code == 27) %>%
to make sure you filter only the bcr region.
This gives the desired second image above.
What "data/gis-data.gpkg"
file are you using? The one available for download via the website only includes BCR 27 so you shouldn't need to use filter(bcr_code == 27)
That makes plenty of sense now! I was using the older gis geopackage that included all of the bcr regions.
I have implemented code that plots species encounter rate of the Northern Bobwhite onto a map, whilst only displaying data for a small portion of this map. However, the plotted map shows the entire region, in this case North America, I wish for only the area displayed with data to show.
I have been following the code as it is.
This is what it looks like:
What I want it to look like: