The goal is to create a video that will play in full screen (on a screen of 1280 x 800) from two ggplot arranged vertically with grid.arrange() . For example:
library(ggplot2) library(gridExtra) library(animation) saveVideo({ for (i in 1:50) { data = data.frame(x=rnorm(1000),y=rnorm(1000)) plot1 = ggplot(data, aes(x=x, y=y)) + geom_point() plot2 = ggplot(data, aes(x=y, y=x)) + geom_point() grid.arrange(arrangeGrob(plot1, plot2, heights=c(3/4, 1/4), ncol=1)) ani.options(interval = 0.05, ani.dev="png", ani.height=800) } },video.name = "test_png.mp4", other.opts = "-b 1000k")
However, the video quality is not satisfactory for full screen mode. I tried to increase the "-b 1000k" , but it seems to me that it only increases the file size and output definition.
- Which device should I use?
- How to increase the height of the canvas (
ani.height=800 , it seems to give no result)?
EDIT: I tried a script with the option other.opts = "-s 1280x800" . Although the image is now wider, the definition is still low. Here's a screenshot (top to bottom) taken from my 1280x800 display (compare the video with the menu bar):
:
r animation video knitr
Cptnemo
source share