Skip to content

How to plot multiple datasets

4 messages · Bruce Kindseth, Rui Barradas, Sarah Goslee +1 more

#
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:
#
Hi Bruce,

That really isn't enough for anyone to be able to answer your
question. In the simplest possible reading, you need lines() or
points(), but your mention of regression leads me to believe you might
want something more complex.

Why don't you take a look at
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
and figure out how to clarify your question?

Sarah
On Thu, Jan 3, 2013 at 11:39 AM, Bruce Kindseth <bkindseth at cox.net> wrote:
--
Sarah Goslee
http://www.functionaldiversity.org
#
Or
"blue"), pch=1) # symbols
"blue"), type="l") # lines

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352