-1

I have the next issue:

I am working with matches of volleyball. So, I have the points of each team in one set. Thus, I plot the points from one team in one figure, and in other figure, the points of the remain team is plotted.

Now, I want to plot in 1 figure those 2 first plots, making a comparative. While the x-axis is the same for the two teams, the y-axis changes as is obvious, because there is a team that achieves more points.

Dataset example: (number_of_play,point)

Team A: (1,0), (2,1), (3,2), (4,3) , (5,4).....

Team B: (1,1), (2,1), (3,1), (4,1) , (5,1) .....

user2228819
  • 33
  • 1
  • 4
  • 1
    Post example dataset ("I am working with matches of volleyball" doesn't help). – pogibas Apr 11 '15 at 10:38
  • [How to make a great R reproducible example?](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – zx8754 Apr 11 '15 at 10:38
  • Dataset example: (number_of_play,point) Team A: (1,0), (2,1), (3,2), (4,3) , (5,4)..... Team B: (1,1), (2,1), (3,1), (4,1) , (5,1) ..... – user2228819 Apr 11 '15 at 10:48

1 Answers1

1

You can use ggplot2, just format your data before (I use melt function from rehsape2 package here):

library(ggplot2)
library(reshape2)

df = data.frame(set=1:5,A=0:4,B=rep(1,5))
df1 = melt(df, id.vars='set', variable.name='team')

ggplot(df1, aes(x=set, y=value, color=team)) + geom_line()

enter image description here

Colonel Beauvel
  • 30,423
  • 11
  • 47
  • 87