解决方法:直接用theme_classic()
示例:
install.packages(“ggplot2”) #安装ggplot2 包。
library(ggplot2) #载入ggplot2 包。
data(women) #导入R语言内置数据集women。
ggplot(data = women, mapping = aes(x=height, y=weight ))+geom_point(color=”black”, size=1)+theme_classic()
#使用ggplot()函数绘图, 使用“+”连接不同函数命令,注意“+”不能在第一行的开头,最好放在每行的末尾。
#geom_point()绘制散点图,theme_classic() 可以改背景为白色且无网格线。
ggsave(filename = “1-1.png”) #保存图片为png格式。
ggsave(filename = “1-2.pdf”) #保存图片为pdf格式 。
© 版权声明
文章版权归作者所有,未经允许请勿转载。如内容涉嫌侵权,请在本页底部进入<联系我们>进行举报投诉!
THE END



















暂无评论内容