I try to save plots with different angles (want to use it later for an animation in beamer). I tried this:
data=data.frame(x=rnorm(100)) # creates the data
plot <- ggplot2::qplot(x, data=data, geom="histogram") # create a histogram
for(i in seq(-90, 0, by = 30)){ # sequence of angles
print(plot, vp=grid::viewport(angle=i)) # rotate with differen angles
ggplot2::ggsave(paste0("plots/plot_", i, ".png")) # save every plot with the name of the angle
}
The Warning is: Warning: cannot clip to rotated viewport
How can I clip the viewport correctly?