使用ggplot,未加载在r控制台中的图
每当我运行项目中包含图的代码块时,它都不会加载但没有显示任何错误消息,就好像控制台被冻结了,然后最终会淘汰。我已经运行了20次或更多的代码脚本,一切都很好,但是现在由于某种原因未知,它就无法正常工作。
我已经尝试过:
- 重新启动R
- 重新安装R
- 更新和安装软件包再次
- 运行以前运行的不同RMD/项目,(它们也不起作用)
任何其他代码块都会执行罚款,而其他软件包似乎都像往常一样运行。我目前正在运行最新的rstudio 4.1.3 build 492。
无论如何,这是我的代码:
budget_revenue <- ggplot(data = filtered_movies2) +
geom_point(mapping = aes(x = budget, y = revenue, colour = genre_1)) +
facet_wrap(~ genre_1, nrow = 2) +
labs(title = "Budget and Revenue by Genre", x = "Movie Budget", y = "Gross Revenue") +
scale_y_continuous("Gross Revenue",
breaks = scales::breaks_extended(8),
labels = scales::label_dollar()) +
scale_x_continuous("Movie Budget",
breaks = scales::breaks_extended(5),
labels = scales::label_dollar()) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, vjust = 0.5)) +
theme(legend.position = "none")
budget_revenue +
scale_colour_viridis_d()
Whenever I run code chunks containing plots within my project, it fails to load but doesn't display any error message, as if the console is frozen and then eventually times out. I have ran this code script 20 times or more and it all worked fine, but now for some reason unknown it just won't work.
I have tried:
- Restarting R
- Reinstalling R
- Updating and installing packages again
- Running different Rmd's/projects which have been run before, (they don't work either)
Any other code chunk will execute fine and other packages all seem to be operating as usual. I am currently running the latest Rstudio 4.1.3 build 492.
Here is my code anyway:
budget_revenue <- ggplot(data = filtered_movies2) +
geom_point(mapping = aes(x = budget, y = revenue, colour = genre_1)) +
facet_wrap(~ genre_1, nrow = 2) +
labs(title = "Budget and Revenue by Genre", x = "Movie Budget", y = "Gross Revenue") +
scale_y_continuous("Gross Revenue",
breaks = scales::breaks_extended(8),
labels = scales::label_dollar()) +
scale_x_continuous("Movie Budget",
breaks = scales::breaks_extended(5),
labels = scales::label_dollar()) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, vjust = 0.5)) +
theme(legend.position = "none")
budget_revenue +
scale_colour_viridis_d()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下关闭并重新启动我的机器,它允许所有更新和恢复原状的生效,并解决了问题。
With closing down and rebooting my machine, it allowed for all updates and reinstallation's to take effect and the issue was solved.