Hello,

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):

df<-data.frame(x=1:10,y1=1:10,y2=11:20)

I would like to see it on the same plot with different colours.

The only thing I can think of is:
df2<-rbind(df,df)
df2[1:10,"y"]<-df$y1
df2[11:20,"y"]<-df$y2
df2[1:10,"yType"]<-'y1'
df2[11:20,"yType"]<-'y2'

ggplot(df2,aes(x=x,y=y,colour=yType))+geom_point(shape=1)

Is there a better way?

Thanks in advance,
Ramiro

	[[alternative HTML version deleted]]

