R的ggplot2画图,去除灰色阴影和网格的方式
时间:2022-07-26 10:04:05|栏目:|点击: 次
使用代码
+ theme_bw() +
theme(panel.grid.major=element_line(colour=NA),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
panel.grid.minor = element_blank())
补充:R语言的ggplot2画图去掉图例的灰色背景
R语言默认的图例如下
library(ggplot2) ggplot(iris,aes(x=Sepal.Length,y=Sepal.Width))+ geom_point(aes(color=Species))

图例的位置是带灰色背景的
如果要去掉应该如何实现呢?可以在主题函数里进行设置

library(ggplot2) ggplot(iris,aes(x=Sepal.Length,y=Sepal.Width))+ geom_point(aes(color=Species))+ theme(legend.key = element_blank())

栏 目:
本文地址:http://www.codeinn.net/misctech/208998.html






