如何调整图例大小?

问题描述 投票:0回答:1
guides(color = guide_legend(ncol=2, 
                            override.aes = list(size=c(1,0.05,0.05,1,0.05,0.05),
                            color = c("red", "red", "red", "blue", "blue", "blue"),
                            linetype = c("solid", "dashed", "dashed", 
                                         "solid", "dashed", "dashed")))) +
labs(x = "vote round", y = "RT(Millisecond)") +

好像

override.aes = list(size=c(1,0.05,0.05,1,0.05,0.05)
做不出来?

r ggplot2
1个回答
0
投票

我们可以使用

theme(legend.key.size = unit(1.5, "cm"))
来调整图例的大小,这里是一个例子:

library(ggplot2)

ggplot(mtcars, aes(x=cyl, y=mpg, color = factor(am))) +
  geom_point() +
  labs(color = "My Legend") +
  theme(legend.key.size = unit(1.5, "cm"))

© www.soinside.com 2019 - 2024. All rights reserved.