How can I change the legend geometry in ggplot2
问题 Hello say I plot this boxplot: library(ggplot2) DT <- data.frame( y = runif(400, max = 2), grp = sample(c('M', 'F'),size = 400, replace = T), x = rep(as.Date(1:10,origin='2011-01-01'), each = 40) ) p <- ggplot(DT) + geom_boxplot() + aes(x = x, y = y, group=interaction(x,grp), fill=grp) p Question is how can I replace those little boxes in the legend by lines (like I would have using graphics ) 回答1: easiest option might be to make the lines invisible, p + guides(fill = guide_legend(override