问题
I have read in a netcdf file of observed climate data (global surface temperature) to R and would like to plot some species locality data (latitude/longitude coordinate points) over the top of this but am having difficulties doing so.
I have generated my map of temperature using:
obsula.pdclann <- open.ncdf("obsula.pdclann.nc")
temp_var <- "temp_mm_1_5m"
temp <- get.var.ncdf(obsula.pdclann, varid=temp_var)
image.plot(temp)
My species occurrence data are read in via the following:
speciesall <- read.table("C:/Users/Waterson/Documents/UOB/Data/speciesData/P.subrufa.txt", header=T, sep="\t")
coordinates <- cbind(speciesall$longitude, speciesall$latitude)
I have then created a SpatialPointsDataFrame with the coordinates:
speciesall_df <- SpatialPointsDataFrame(coordinates, speciesall, proj4string=CRS("+proj=longlat +ellps=WGS84"))
Now I am unsure of how I go about combining the point data with the netcdf map?
来源:https://stackoverflow.com/questions/22833647/how-to-plot-latitude-longitude-points-over-netcdf-map