I have a data frame (df1) in the form:
x1 y1 x2 y2
1 0.745779796 0.5728328 2.04029482 -0.71989471
2 0.008949224 0.8318262 1.01426596 1.20956795
3 2.390108913 0.8041999 1.63621459 0.19979352
4 1.478310218 -0.7179949 1.52394275 0.96091747
5 1.051357060 0.9700232 0.00546977 0.03604669
6 0.123499864 2.0340036 0.08231778 1.29889103
I'm having the hardest time using ggpplot 2 to create a scatter plot that has both series 1 (y1 vs x1) and 2 (y2 vs x2). I've tried to melt
the data frame in order to have a "factor" with which to use in aes()
, but I'm sure I'm using melt wrong, and can't figure out why:
df<-melt(df,id.var)
My main question is this though: are there any easier ways to organize this data such that, in one ggplot
command, I can graph each x-y pair as a separate series on a scatter plot?