[R] scatterplot of two y's
macqueen1 at llnl.gov
Wed Feb 19 20:38:22 CET 2014
The quickest way, using the example data, would be
matplot( df$x, df[,-1])
Obviously doesn't have the nice ggplot style, but it does do what was
requested. And depending on the context and ultimate goal, may be
Simple improvements are easy:
matplot( df$x, df[,-1],
xlab='x', ylab='y1, y2',
pch=c(1,4) , main='My Data' )
As a personal and editorial aside, I often think that amongst all of the
great extensions to R that have been developed over the years, the basics
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
On 2/17/14 2:41 PM, "Ramiro Barrantes" <ramiro at precisionbioassay.com>
>Sorry if this is repeated somewhere, I imagine it must be a common issue
>but I can't find an answer!
>I have a data.frame with two responses, example (response variables to x
>are y1 and y2):
>I would like to see it on the same plot with different colours.
>The only thing I can think of is:
>Is there a better way?
>Thanks in advance,
> [[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.
More information about the R-help