library(ggplot2)
p<-ggplot(data = diamonds) +
geom_bar(mapping = aes(x = cut,fill=clarity))
p
pdf("保存.pdf",width=6,height=6,)
ggplot(data = diamonds) +
geom_bar(mapping = aes(x = cut,fill=clarity))
dev.off()
保存为pdf
保存为tiff
tiff(file='保存.tiff',
width = 6,