r - gganimate 在 windows 10 中呈现像素化

标签 r animation ggplot2 gganimate

我必须使用 gganimate 渲染一些动画,但图像不好看。它们缺乏清晰度,边界像素化。有什么方法可以在 Windows 10 中获得更好的结果吗?

我的代码是:

library(gapminder)
library(ggplot2)
library(gganimate)
Cairo(600, 600, file="plot.png", type="png", bg="white")
ggplot(gapminder,aes(gdpPercap, lifeExp, size = pop, colour = country)) +
  geom_point(alpha = 0.7, show.legend = FALSE) +
  scale_colour_manual(values = country_colors) +
  scale_size(range = c(2, 12)) +
  scale_x_log10() +
  facet_wrap(~continent) +
  # Here comes the gganimate specific bits
  labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
  transition_time(year) +
  ease_aes('linear')

我得到的是这样的:

enter image description here

最佳答案

可以通过options()修改默认分辨率

options(gganimate.dev_args = list(width = 5, height = 7, units = 'in', res=320))

关于r - gganimate 在 windows 10 中呈现像素化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52928178/

相关文章:

r - Shiny 在单行中使用超过 12 列

r - 来自 dismo::gmap() 和 ggplot2 的谷歌地图

python - 如何模糊 3d matplotlib 中的点

r - 通过关键字指定 geom_text 的位置,如 "top"、 "bottom"、 "left"、 "right"、 "center"

r - aes里面的函数

r - 在不增加图例键的情况下增加图例键之间的空间

linux - 如何使用远程访问在 Linux 上运行 Shiny Server?

r - 以 csv 格式下载生成的表 - R Shiny

html - CSS3 不透明度动画 + 显示 :none

android - 如何在 Android 的 XML 中构建 Animator 上/下滑动?