0

Basically, I have 3 columns Id, A and B.

Data contains for same value of Id different A and B values. I need to plot between A and B for same Id. Any idea how to do it in R ?

rach
  • 141
  • 8
  • 1
    Please provide few lines of your dataset http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – akrun Apr 02 '15 at 16:33
  • Do you want Id on the x-axis and the values of A and B on the y-axis in the same plot or plot of B vs A? – jwilley44 Apr 02 '15 at 16:35
  • If you need a plot A vs B grouped by Id, perhaps `library(ggplot2); ggplot(df1, aes(x=A, y=B))+ geom_point(aes(colour=factor(id)))` – akrun Apr 02 '15 at 16:47

1 Answers1

0

You mean this basic graph:

library(ggplot2)

data<-data.frame(ld=c(1,2,3),A=c(10,20,30),B=c(100,200,300))

ggplot(data,aes(x=ld))+
  geom_point(aes(y=A),col="brown1",size=5)+
  geom_point(aes(y=B),col="blue",size=5)+
  ylab("A-B") 
Soheil
  • 954
  • 7
  • 20