Created
April 14, 2010 02:23
-
-
Save jduckles/365374 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(lattice) # ?xyplot for more info on the myriad of ways to use lattice | |
library(reshape) # need melt() and rename() to reshape data frame for easy plotting | |
# Lets plot "WorldPhones" from package datasets | |
wp <- rename(melt(WorldPhones), c(X1 = 'year', X2 = 'country', value = 'numphone')) | |
xyplot( numphone ~ year | country, data=wp, type="b", scales="free") | |
# To print multiple pages set layout=c(1,1) to plot 1 plot per page (or more if it makes sense) | |
pdf('~/path/to/mydoc.pdf', width=11, height=8.5) | |
xyplot( numphone ~ year | country, data=wp, type="b", scales="free", layout=c(1,1) ) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment