0

I have a small data set consisting of two columns of data and a column designating which of the two sites the data was taken at. I have used xyplot to sort by groups, but I can't figure out how to alter the symbology of each group separately. I also need to add a regression line, and can only figure out how to do that in plot. What graphics package can give me these features in the same graph?

I have looked into different graphics packages to find one in which I can do everything I need, but I am new to R and am not having much luck.

thor
  • 21,418
  • 31
  • 87
  • 173

1 Answers1

0

ggplot2 is your go-to.

Try this:

install.packages('ggplot2')
library(ggplot2)
one=c("A","B","A","B")
two=c(1,2,3,4)
three=c(5,7,8,20)
df<-data.frame(one,two,three)
ggplot(df,aes(x=two,y=three,col=one))+geom_line()
nak5120
  • 4,089
  • 4
  • 35
  • 94