EDIT: sorry, I didn't read your question correctly the first time.. but my former answer is still valid, you just have to change which columns represent the facets and which the x axis labels (I edited the answer below)
with the ggplot2 library:
library(ggplot2)
nuins <- read.table("nuin_plot.txt", na.strings='N/A')
names(nuins) <- c("seq", paste("column_", 2:8, sep=''))
nuins.melt <- melt.data.frame(nuins, id="seq")
qplot(variable, value, data=nuins.melt, facets=~seq) + opts(axis.text.x=theme_text(angle=60, hjust=1.2, ))
explanation: for semplicity, we first melt the dataframe into a new df in which all the V2,3,.. columns are merged into a single one. Do an head(nuins.melt) to see how it looks like.
Then, we use ggplot's basic command qplot to create a facetted plot for every variable; the 'opts' command is just to make the x labels easier to read.
I know it could be seem strange to melt the data frame into another one with only two columns, but that way you can use ggplot2's functions (or even lattice) easier. You reduce the problem to a prototype that you can solve easily.
ggplot2 output:
http://yfrog.com/5jnuinp
This is another solution, with lattice (remember to melt the data first):
xyplot(value~variable|seq, data=nuins.melt, as.table=T, layout=c(2,3,1))
In this case I recommend you to use the lattice solution, because the xyplot has a parameter called 'layout' in which you can define in how many rows, columns and pages you want your plot to be drawn. for example, if you want the former figure to have 2 columns and 2 rows, and to be splitted into 2 pages, you can pass 'layout=c(2,2,2)' as parameter to the xyplot call.
http://yfrog.com/ginuinlatticep
Thanks, great solutions.
Really nice answer. Just a little extra detail: the
facet_grid()
andfacet_wrap()
functions in ggplot2 are the rough equivalents of the layout argument in lattice. Though I don't think they can split into pages...@Matt: thank you for the comment. Actually, I proposed to ggplot2's author (Hadley Wickham) to implement a parameter to split plots into multiple pages. If you want, you can vote the report, but it should be already in his priority list. http://groups.google.com/group/ggplot2/browse_thread/thread/cec806495cab9dd/a2fe740bb55f4bf2