[R] Help Please, ggplot2

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Mon Apr 1 23:22:10 CEST 2013


Your example is not reproducible [1]. We don't know what device you are writing to, and we don't have your data or even a subset of it.

However, facet_wrap is not used for generating separate graphs. You will need to make some kind of loop construct (for or lapply) that opens the device, prints the plot of a subset of the data (without faceting), and closes the device, for each group in your data. 

[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

David Lyon <david_lyon3 at yahoo.com> wrote:

>library(ggplot2)
>a<- read.table("data", header=T)
>b = na.omit(a)
>ggplot(data=b) + geom_line(aes(x=timepoint, y=value,group=sample,
>colour= factor(sample))) +  geom_point(aes(x=timepoint, y=value,
>group=s
>ample)) + facet_wrap(~bio, scales = "free",ncol = 5) +theme_bw() +
>opts(legend.direction = "horizontal",    legend.position = "top",    
>legend.background = theme_blank()) +  labs(fill="")
>dev.off()
>
>
>This generates one nice plot with many many plots in 1 file.
>How do I modify the code to split up the plots into single file instead
>of merging them in 1 file I want each plot to be in a separate file ?
>
>Thanks in advance
>
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list