I'm new with R. I want to plot 3 lines in one graph. This is my data: print(x) V1 V2 V3 V41 -4800 25195.73 7415.219 7264.282 -2800 15195.73 5415.219 7264.28
I tried using matplot, but I cannot get exactly what I want. This is what I get, and this is my code: matplot(x[,1],x[,-1],type='b', xlab = "epsilon_h", ylab = "Value2", xlim= range(-4500,-100), col = c("blue","green","red"), pch=1:3) ex12 <- expression(V(h == 40), V(h==20), V(h==0)) legend("topright", ex12, col = c("blue","green","red"), pch=1:3) I would like to make the lines extend so I can see the intersections. The other, fancier and better looking, option that i found is ggplot2. But for what I understand from the example<http://wiki.stdout.org/rcookbook/Graphs/Scatterplots%20(ggplot2)/>I would need to reshape my data to something like this id x y 1 1 -4800 25195.73 2 1 -2800 15195.733 2 -4800 7415.2194 2 -2800 5415.2195 3 -4800 7264.286 3 -2800 7264.28 Thanks a lot for the help! -Ignacio [[alternative HTML version deleted]] ______________________________________________ R-help@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.