相关疑难解决方法(0)

删除ggplot中图例键周围的填充

我想删除图例周围的灰色矩形.我尝试了各种方法,但都没有.

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 = year, y = value)) + geom_point(aes(colour=gender))  +
stat_smooth(method = "loess", formula …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

23
推荐指数
3
解决办法
2万
查看次数

标签 统计

ggplot2 ×1

r ×1