# NOT RUN {
# 1. create a line programmatically
coords <- data.frame(x = c(40, 70, 70, 50),
y = c(40, 40, 60, 70))
# if no window is set, the bounding box will be set as window
(aGeom <- gs_line(anchor = coords))
# the vertices are plottet relative to the window
window <- data.frame(x = c(0, 80),
y = c(0, 80))
aLine <- gs_line(anchor = coords, window = window)
visualise(aLine, linecol = "green")
# when a geom is used in 'anchor', its properties are passed on
aGeom <- setWindow(x = aGeom, to = window)
aLine <- gs_line(anchor = aGeom)
visualise(aLine, linecol = "deeppink")
# 2. sketch a line
if(dev.interactive()){
aLine <- gs_line(vertices = 4)
visualise(aLine, linecol = "orange", linewidth = 5, new = FALSE)
}
# }
Run the code above in your browser using DataLab