So I've had this problem for a few days now. Basically what I have is a table with Field Site latitudes/longitudes represented as numerics. Associated with each Site Id is different chemical data that I want to plot. Here is what the table looks like. [Table Description][1][1]: https://i.stack.imgur.com/m4vH5.png
I've also uploaded a shapefile. [Shapefile][2][2]: https://i.stack.imgur.com/sDFca.png
Now what I want to do is plot these data points with these chemical data unto the map using ggplot. I first used the code
Master_cave_data <- Master_cave_data %>%
st_as_sf(coords = c('Long_DD', 'Lat_DD'), crs = 4326, sf_column_name = NULL)
This worked and I also converted the data set into a data frame using the code
Master_cave_data <- as.data.frame(Master_cave_data)
But I still can't plot the data points onto the shape file. Do I have to plot them using tmap? Thanks for the help
You should be able to use geom_sf()
in your ggplot call to plot sf objects . You don't even need the as.data.frame
conversion.
ggplot(Master_cave_data) +
geom_sf()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.