<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br></div><br><br><div dir="ltr">Hello sir/madam,<div><br></div><div>I have been writing codes using R and was trying to overlay contour lines on the map using the data set provided in the attachment. The code which I am working on is attached below. The problem is the overlay of the contours is not showing in the final map. If someone can assist in correcting the codes would be really appreciated .</div><div><br></div><div> # Packages</div>#if (!require("rspatial")) remotes::install_github('rspatial/rspatial')<br>library(rspatial)<br>library(sp)<br>library(rgdal)<br>library(rgoes)<br>library(raster)<br>library(ggplot2)<br><br># Fiji geo data<br># download<br>#Draft map of Fiji<br>world <- rnaturalearth::ne_countries(scale = "Large", returnclass = "sf")<br><br># map of Fiji Islands<br>Fiji <- ggplot(data=world) +<br>  geom_sf() + <br>  coord_sf(<br>    crs = 3832, # <a href="https://epsg.io/3832" target="_blank" rel="noreferrer">https://epsg.io/3832</a><br>    xlim = c(2984265.06, 3539584.72), # limits are taken from projected bounds<br>    ylim = c(-2224162.41, -1811688.88)  # of EPSG:3832<br>  )+ theme_bw()<br><br>#Plot map of Fiji  <br>Fiji<br><br>#read csv data from excel file for contoure analysis<br>data.Fdf <- read.csv("C://Users/Sownal/Documents/data.csv")<br>View(data.Fdf)<br>class(data.Fdf)<br><br>#remove NA values in the spatial Data Frame<br>data.dfclean <- na.omit(data.Fdf) <br>data.dfclean<br><br>data.dfclean$long <- as.numeric(data$Longitude)<br>data.dfclean$lat <- as.numeric(data$Latitude)<br><br># convert data to spatial data fame for spatial analysis and raster analysis<br>data.FSP <- SpatialPointsDataFrame(data= data.dfclean, coords = data.dfclean$lat, data.dfclean$long)<br>data.FSP<br>#select one years data and overlay contours on the Map of Fiji<br><br>Fiji <- ggplot(data=world) +<br>  geom_sf() + <br>  coord_sf(<br>    crs = 3832, # <a href="https://epsg.io/3832" target="_blank" rel="noreferrer">https://epsg.io/3832</a><br>    xlim = c(2984265.06, 3539584.72), # limits are taken from projected bounds<br>    ylim = c(-2224162.41, -1811688.88)  # of EPSG:3832<br>  )+ theme_bw() + filled.contour(data.dfclean$Year)<br><br><br># plot the map of Fiji with the contours lines <br>Fiji<div><br></div><div>******************************************************************************************************</div><div><br></div><div>Thanking you in advance</div><div>sownalc</div></div>
</div></div></div>