【发布时间】:2021-07-20 17:00:10
【问题描述】:
我是 R 新手,有点迷茫。
我有一个代码:
jpg <- (
xyplot(
USD + EUR ~ data,
data = ret,
type = "l",
ylab = "GBP",
xlab = "month",
key = list(space = "right",
columns = 1,
text = list(c("EUR", "USD")),
rectangles = list(col = c("pink", "green")),
cex = 0.7))
)
x11()
print(jpg)
感谢它,我可以在新窗口中自动打开我的情节。 我想对这段代码做同样的事情:
levels(factor(mtcars$cyl))
levels(factor(mtcars$gear))
ggplot(mtcars, aes(factor(cyl), mpg)) +
geom_boxplot() +
transition_states(
gear,
transition_length = 2,
state_length = 1
) +
enter_fade() +
exit_shrink() +
ease_aes('sine-in-out') +
labs(title = 'Fuel consumption for {closest_state} gears', x = 'cyl')
anim_save("mtcars.gif")
,但我不知道怎么做。如何使用 x11() 做到这一点?
【问题讨论】:
标签: r ggplot2 plot x11 gganimate