I have a data set with Eastings, Northings and Age. I want to plot the age for my data set. The dataset is upload in the following loation: https://www.dropbox.com/s/zmtxluhwuupb9iv/age%20at%202100.csv
The code I used to create the simple graph and contour is as follows:
age2100 <- read.csv("age at 2100.csv",header=TRUE, sep=",")
p <- ggplot(age2100, aes(x=Eastings, y=Northings, colour=("Age")))+geom_point()
p+geom_density2d()
The output I got is as follows:
I couldn't upload the image so please find the image at the following dropbox location :
https://www.dropbox.com/s/5k5gefqi7wz6v36/age.png
Now, I want to add a shapefile on the background and clip the contour lines to the shapefile.
The desired output is as follows:
https://www.dropbox.com/s/tqhx2t8cqqozwbt/7Q10%20flow%20dye%20from%20P%20and%20S.JPG
How do I proceed from figure 1 to desired output ? If anyone could give me suggestions, that would be great.
Thank you so much.
Jdbaba
Two possibilities:
ggmap
.fortify
in ggplot
, which has methods for SpatialPolygonsDataFrame
s.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With