How can I merge two plots (layers)? On a first plot there are points with data, and on the second one there is a boundary of those points. Here is what i've got:
data <- read.csv('data.csv')
coordinates(data) <- ~x+y
proj4string(data) <- '+init=epsg:2180'
plot(data)
boundary <- readOGR(dsn='.', layer='boundary')
plot(boundary)
The thing is, that I want to merge boundary with data. I also want to change a colour of boundary. Thank you in advance.
What you want might be polygon
#Example Data
set.seed(42)
mydata = cbind(rnorm(100),rnorm(100))
boundary = mydata[chull(mydata),]
#Plot points first
plot(mydata,xlab="X-axis",ylab="Y-axis")
#Then plot the boundary
polygon(boundary,lty = 2)