更新时间:2023-11-26 13:10:16
要指定图例框的大小,可以使用+ theme(legend.key.size = unit(2, "cm"))
.
To specify the legend box size you could use + theme(legend.key.size = unit(2, "cm"))
.
library(tidyverse)
tb <- tibble(a = 1:10, b = 10:1, c = rep(1:2, 5))
ggplot(tb, aes(a, b, colour = c)) +
geom_point() +
theme(legend.key.size = unit(0.2, "cm"))
More details and additional modifications are here and under the keywidth argument here.