|
hello,
plot(running(-log10(results_chr_p$empi_p), fun=mean, width=41, font.axis=4, by=1),type="l",cex=0.1, ylab="-Log(p)", ylim=c(0,5.0), xlab=" ", lwd=2) this is my code to make a plot. The problem is, now I want to add one more curve to the plot, which is for another variable in the data.frame -log10(results_chr_p$p). My question is: how to make multiple lines in one plot, especially when using the 'running' function in it?? thank you very much, karena |
|
Dear Karena,
Please read the posting guide : your example cannot be reproduced because we don't know in which package the 'running' function resides. Generally speaking, use 'points' or 'lines' to add points or lines to the current device. greetings, remko |
|
In reply to this post by karena
Hi Karena,
As Remko mentioned, it really is polite to say what package your function is from if its not one of the basics (such as base or stats). Also, it is nice to give us sample data (side note, both of these things are mentioned in the posting guide which you may find here: http://www.r-project.org/posting-guide.html). In any case I was able to search and find what is most likyle the function you are using. Although it does not make particular sense, here is an example plot with two sets of different lines added. They incorporate results from running(), although the general plot() and lines() function do not really care where the x and y values came from. library(gtools) set.seed(1212) dat <- runif(100) plot(dat, running(dat, width = 5, pad = TRUE)) lines(dat, running(dat, width=10, fun = median, pad = TRUE)) lines(dat, running(dat, width=10, fun = mean, pad = TRUE), col = "blue") HTH, Josh On Mon, Nov 1, 2010 at 8:34 PM, karena <[hidden email]> wrote: > > hello, > > plot(running(-log10(results_chr_p$empi_p), fun=mean, width=41, font.axis=4, > by=1),type="l",cex=0.1, ylab="-Log(p)", ylim=c(0,5.0), xlab=" ", lwd=2) > > > this is my code to make a plot. The problem is, now I want to add one more > curve to the plot, which is for another variable in the data.frame > -log10(results_chr_p$p). My question is: how to make multiple lines in one > plot, especially when using the 'running' function in it?? > > thank you very much, > > karena > -- > View this message in context: http://r.789695.n4.nabble.com/how-to-make-multiple-curves-in-one-plot-tp3023135p3023135.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ ______________________________________________ [hidden email] 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. |
| Powered by Nabble | Edit this page |
