我有一个情节,然后我更改了一些默认属性,ggplot
例如font face, font color, bold
等。但是,当我使用命令或从Rstudio's plot
图像打开情节时,包含我所有的自定义属性。
但是,当我使用ggsave
它保存绘图时,不会显示和保存图像的所有自定义属性。更具体地说,我保存的图像未显示them()
.
我的代码如下
plot <- ggplot(plot_df, aes(Region, diff, fill = Region))+
geom_bar(stat = "identity", width = 0.8, position = position_dodge(width = 0.9))+
theme_bw()+
theme(panel.grid = element_blank(),
plot.title = element_text(color = "black", face = "bold"),
axis.text.x = element_text(colour="black",size=10,face="bold"),
axis.text.y = element_text(colour="black",size=10,face="bold")
)+
xlab("Region")+
ylab("Average Region Rainfall (mm)")+
ggtitle("Average Region Ranfall")
使用保存代码ggsave
ggsave("~/My/plot.png", plot = plot+
theme_bw(base_size = 10, base_family = "Times New Roman"), width = 10, height = 8, dpi = 150, units = "in", device='png')
有没有办法使用ggsave保存原始情节?