I want to generate a multiple-column legend (2 or more) for the following figure using this piece of code. But the guides() does not work properly. Can someone help me?
library(ggplot2)
testdf <- data.frame(site=unlist(strsplit(rawToChar(as.raw(65:90)),split = '')),
x = c(seq(0:24),80), y = seq(1:26))
testdf$colours <- 'red'
p <- ggplot(data=testdf,aes(x,y))
p + scale_shape_manual(values=testdf$x)+
scale_colour_manual(values=testdf$colours)+
geom_point(aes(shape=site,colour=site),size=5)+
guides(col=guide_legend(ncol=3,byrow=TRUE))
Thanks, Katie

guides(shape=guide_legend(ncol=3,byrow=TRUE))will do, I think