r - R绘图不保存为png,请检查我的代码
问题描述
我已经为正确的绘图编写了代码,但我无法将其保存为 png 文件。我在绘制之前使用了 png() 函数,之后使用了 dev.off() 并且它不会保存。顺便说一句,我没有包括读取数据和创建变量。(苹果电脑)
我已经尝试了一切,没有任何效果。有没有办法保存全图?
png(filename = "plot_3.png", width = 480, height = 480)
p1 <- (ggplot(PTsum, aes(x=Group.1, y =x))
+ geom_bar(stat="identity", color="black"
, fill="gray") + ggtitle("Point") +
xlab("Date") + ylab("Total Emission"))
p2 <- (ggplot(NPTsum, aes(x=Group.1, y =x))
+ geom_bar(stat="identity", color="black"
, fill="gray") + ggtitle("NonPoint") +
xlab("Date") + ylab("Total Emission"))
p3 <- (ggplot(Rsum, aes(x=Group.1, y =x))
+ geom_bar(stat="identity", color="black"
, fill="gray") + ggtitle("Road") +
xlab("Date") + ylab("Total Emission"))
p4 <- (ggplot(NRsum, aes(x=Group.1, y =x))
+ geom_bar(stat="identity", color="black"
, fill="gray") + ggtitle("NonRoad") +
xlab("Date") + ylab("Total Emission"))
fullplot <- multiplot(p1,p2,p3,p4,cols=2)
dev.off()
我希望有一个名为 plot3.png 的文件,但它不存在
解决方案
推荐阅读
- php - 在会话中存储 url 并在 fb 或 google 重定向后返回页面
- java - 如何在 JVM 中添加一些参数?
- wagtail - 使用最小/最大子级实现 Wagtail ListBlock 模块
- javascript -
- javascript - 异步等待 Firebase 云函数在包含三个等待行时超时
- android - 在 Ionic 4 中将 PDF 保存到设备
- java - `var x` 和 `int x` 之间有什么区别吗?
- r - 将 Bloomberg Rblpapi 更改为累积数据
- javascript - 使用按钮选择选择选项
- twilio - Twilio API Stats 调用以检索代理平均/最大/总保持时间?