R语言中ggplot2绘图如何同时清除灰色背景、框格、上框线和右框线

 

001、测试基本绘图

data=iris                               ## 导入数据
library(ggplot2)                        ## 加载包
ggplot(data = data, aes(x=Petal.Length,y=Sepal.Length)) +       ## 基本绘图程序 
  geom_point()

 

 

002、清除灰色背景、背景框线、上框线、右框线

data=iris
library(ggplot2)
library(cowplot)                              ##  使用cowplot包
ggplot(data = data, aes(x=Petal.Length,y=Sepal.Length)) + 
  geom_point() + theme_cowplot()              ## 增加 + theme_cowplot()语句

 

posted @ 2022-09-09 22:27  小鲨鱼2018  阅读(2504)  评论(0编辑  收藏  举报