[R] How to plot multiple datasets
Rui Barradas
ruipbarradas at sapo.pt
Thu Jan 3 19:53:37 CET 2013
Hello,
You shuld provide a data example, but see if the following is what you
are looking for.
x <- 1:10
y1 <- rnorm(10)
y2 <- rnorm(10)
y3 <- rnorm(10)
# One way
plot(x, y1, ylim = range(c(y1, y2, y3)))
points(x, y2, col = "red")
points(x, y3, col = "blue")
# Another way
plot(x, y1, ylim = range(c(y1, y2, y3)), type = "l")
lines(x, y2, col = "red")
lines(x, y3, col = "blue")
Hope this helps,
Rui Barradas
Em 03-01-2013 16:39, Bruce Kindseth escreveu:
> Good Morning,
>
> I have 3 sets of data, all with the same horizontal axis but with varying
> vertical input. I want to plot all 3 sets on one x-y plot. I can get 3
> linear regression plots and 3 polynomial regression plots on the same chart
> but I have not been able to get more than one set of input data on the same
> chart. Can you help me?
>
> Thank you for all that you do to provide R to the public.
>
> Bruce Kindseth
>
> Narragansett, RI
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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