Skip to content

Instantly share code, notes, and snippets.

@kohske
Created August 11, 2011 14:48
Show Gist options
  • Save kohske/1139848 to your computer and use it in GitHub Desktop.
Save kohske/1139848 to your computer and use it in GitHub Desktop.
ggplot2: example codes for matrix-like legend guide
p <- qplot(1:20, 1:20, col=letters[1:20])
p + guides(col=guide_legend(nrow=8))
p + guides(col=guide_legend(ncol=8))
p + guides(col=guide_legend(nrow=8, byrow=T))
p + guides(col=guide_legend(ncol=8, byrow=T))
# output plots: http://yfrog.com/klhjpwp
# how to embed images in gist...?
# you can install very very easily the develop version of ggplot2 on github thanks to Hadley's devtools package.
install.packages('devtools')
install.packages(c("RColorBrewer", "stringr", "dichromat", "munsell", "plyr", "colorspace")) # probably windows only
library(devtools)
dev_mode(TRUE)
install_github("scales")
install_github("ggplot2", "kohske", "feature/new-guides-with-gtable")
library(ggplot2)
@liamxg
Copy link

liamxg commented Oct 17, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment