我必须使用 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')
我得到的是这样的:
最佳答案
可以通过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/