plot,DeponsShips,missing-method | R Documentation |
Plot the tracks that ship agents move along in DEPONS.
## S4 method for signature 'DeponsShips,missing'
plot(x, y, ...)
x |
DeponsShips object |
y |
Not used |
... |
Optional plotting parameters, including 'col', 'main', 'add.legend', and 'legend.xy' (defaults to 'topright' when add.legend=TRUE) |
No return value, called for side effects
data(shipdata)
plot(shipdata, col=c("red", "green", "blue"))
# convert route coordinate units from 'grid squares' to UTM
data(bathymetry)
out <- summary(bathymetry)
left <- out[[4]][1]
bottom <- out[[4]][2]
for (i in 1:3) {
newroute <- shipdata@routes[[2]][[i]]*400
newroute$x <- newroute$x + as.numeric(left)
newroute$y <- newroute$y + as.numeric(bottom)
shipdata@routes[[2]][[i]] <- newroute
}
# Reproject coastline and clip to size of Kattegat landscape
library(sp)
data(bathymetry)
data(coastline)
coastline_sf <- sf::st_as_sf(coastline)
coastline2 <- sf::st_transform(coastline_sf, crs(bathymetry))
bbox <- bbox(bathymetry)
clip.poly <- make.clip.poly(bbox, crs(bathymetry))
plot(shipdata, col=c("red", "green", "blue"), add=TRUE, add.legend=TRUE)
plot(clip.poly, add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.