R语言ggplot2可视化删除图例(legend)周围的灰色矩形(remove the gray rectangle around the legend)
2026/6/5 0:43:33 网站建设 项目流程

 R语言ggplot2可视化删除图例(legend)周围的灰色矩形(remove the gray rectangle around the legend)

目录

R语言ggplot2可视化删除图例(legend)周围的灰色矩形(remove the gray rectangle around the legend)

#图例周围有灰色矩形

 #删除图例(legend)周围的灰色矩形

#无效方案


#图例周围有灰色矩形

ggtheme <- theme( axis.text.x = element_text(colour='black'), axis.text.y = element_text(colour='black'), panel.background = element_blank(), panel.grid.minor = element_blank(), panel.grid.major = element_blank(), panel.border = element_rect(colour='black', fill=NA), strip.background = element_blank(), legend.justification = c(0, 1), legend.position = c(0, 1), legend.background = element_rect(colour = NA), legend.key = element_rect(colour = "white", fill = NA), legend.title = element_blank() ) colors <- c("red", "blue") df <- data.frame(year = c(1:10), value = c(10:19), gender = rep(c("male","female"),each=5)) ggplot(df, aes(x = y

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询