[R] plot two columns against one

Duncan Mackay dulcalma at bigpond.com
Sat Dec 14 23:29:45 CET 2013


or for a different view

library(lattice)

xyplot(B+C ~A, data = s, 
            outer = T, 
           scales = list(relation = "free"), 
          pch = as.numeric(rownames(s)), 
          col = as.numeric(rownames(s)))

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of arun
Sent: Sunday, 15 December 2013 04:30
To: R help
Subject: Re: [R] plot two columns against one

Hi Eliza,
Try:


ggplot(s,aes(x=A,y=B))+geom_point(colour="white",shape=21,size=4,aes(fill=fa
ctor(C)))+theme_bw()+theme(legend.position="none")
A.K.






On Saturday, December 14, 2013 12:29 PM, eliza botto
<eliza_botto at hotmail.com> wrote:

Dear Arun and david,
Thanks for your reply. If instead of text i want to add points, what change
in code should occur?

eliza


> Date: Sat, 14 Dec 2013 07:48:52 -0800
> From: smartpink111 at yahoo.com
> Subject: Re: [R] plot two columns against one
> To: r-help at r-project.org
> CC: eliza_botto at hotmail.com
> 
> HI,
> 
> Using ?ggplot()
> 
> s <-read.table(text="A      B        C
> 0.451  0.333  1134
> 0.491  0.270  1433
> 0.389  0.249  7784
> 0.425  0.819  6677
> 0.457  0.429  99053
> 0.436  0.524  111049
> 0.423  0.270  121093
> 0.463  0.315  131019",sep="",header=TRUE)
> library(ggplot2)
> ggplot(s,aes(x=A,y=B,colour=C))+geom_text(label=s$C) + theme_bw() A.K.
> 
> 
> On Saturday, December 14, 2013 9:30 AM, eliza botto
<eliza_botto at hotmail.com> wrote:
> Dear users of R,
> How can i plot the values in column "C" with "A" on x-axis and "B" on 
> y-axis?s <- "A       B        C     0.451   0.333   1134
> 0.491   0.270   1433
> 0.389   0.249   7784
> 0.425   0.819   6677
> 0.457   0.429   99053
> 0.436   0.524   111049      0.423   0.270   121093       0.463   0.315   
> 131019 Thankyou very much in advance, Eliza
>                           
>     [[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.
>

______________________________________________
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