ggplot2: Divide Legend into Two Columns, Each with Its Own Title
问题 I have these factors require(ggplot2) names(table(diamonds$cut)) # [1] "Fair" "Good" "Very Good" "Premium" "Ideal" which I want to visually divide into two groups in the legend (indicating also the group name): "First group" -> "Fair", "Good" and "Second group" -> "Very Good", "Premium", "Ideal" Starting with this plot ggplot(diamonds, aes(color, fill=cut)) + geom_bar() + guides(fill=guide_legend(ncol=2)) + theme(legend.position="bottom") I want to get (note that "Very Good" slipped in the