[R] Code scatter plot data from matrix with 3rd column
jrkrideau at inbox.com
Tue Jul 3 14:59:08 CEST 2012
Your data is effectively unreadable. Please use dput() to supply sample data.
Here is one way to do what you want for data frames using the ggplot2 package.
mydata <- data.frame(x = 1:10, y = rnorm(10), z = c(rep(1,4), rep(2, 6)))
ggplot(mydata, aes(x, y, colour= as.factor( z))) + geom_point()
Kingston ON Canada
> -----Original Message-----
> From: kbw1123 at yahoo.com
> Sent: Mon, 2 Jul 2012 13:31:36 -0700 (PDT)
> To: r-help at r-project.org
> Subject: [R] Code scatter plot data from matrix with 3rd column
> I am looking for a simple way to plot my data from a matrix (or data
> frame) using a 3rd column as category to code the data points.
> for example:
> Ideally, I'd like 0 or 1 to correspond to a color but I'd settle for a
> symbol at this point. I have tried working with pch but can't get it to
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails
More information about the R-help