I need to rotate the SpatialLines object by 90 and 180 degrees, and then plot the original SpatialLines object with the rotated SpatialLines objects.
However, plot function provides this error:
Error in plot.new() : figure margins too large
I am using RStudio. I tried to restart R Session, restart RStudio and manually zoom out a plot by going to Plots->Zoom Plot... But it does not help to fix the problem.
library(sp)
library(maptools)
x <- c(1,5,4,8)
y <- c(1,3,4,5)
xy <- cbind(x,y)
xy.sp = sp::SpatialPoints(xy)
spl <- sp::SpatialLines(list(Lines(Line(xy.sp), ID=i)))
# Rotation of a SpatialLines object
spl90 <- maptools::elide(spl, rotate=90, center=apply(bbox(spl), 1, mean))
spl180 <- maptools::elide(spl, rotate=180, center=apply(bbox(spl), 1, mean))
plot(spl)
plot(spl90)
plot(spl180)
x11()
before the plot commands? – koekenbakker