I would like to create a ggplot2 with 2 lines. The x,y values for the 2 lines are different. I have done this with regular line plot as
plot(d$ball,d$total,col="blue",type="l",lwd=2,xlab="Overs",ylab='Runs',
main="Worm chart of match")
lines(d1$ball,d1$total,type="l",col="red",lwd=2)
teams <-c(t1,t2)
legend(x="topleft",legend=teams,
col=c("blue","red"),bty="n",cex=0.8,lty=1,lwd=2)
Most of the ggplot2 examples I found assume that x values(usually date) are same with different y values. How can I do this?
Test data
---------
x k y
3.1 1 15
3.2 0 15
3.3 0 15
3.4 0 15
3.5 1 16
3.6 0 16
3.7 1 17
3.8 4 21
4.1 4 21
x1 m y1
2.6 4 15
3.1 0 15
3.2 1 16
3.3 0 16
3.4 4 20
3.5 0 20
3.6 4 24
3.7 0 24
4.1 0 24
4.2 1 25
I need to plot x,y and x1,y1 in a single plot. The number rows will be different and the x,x1 value also may vary slightly