2
votes

I am making a point-plot of 7 time points with two replicates. I want to make a line between the points that belong to the same replicate. Please see my data and code below.

I guess I need to make a group of the replicates?

data

        miRNA      Replicate   0h_rep2   1h_rep2   4h_rep2   9h_rep2  15h_rep2  18h_rep2  21h_rep2
1    hsa-let-7d-5p      rep2 11.485307 11.383846 11.395039 11.660549 11.697380 11.803184 12.225001
2    hsa-let-7e-5p      rep2 10.660692 10.869931 10.984550 10.966696 10.963071 11.315740 11.643941
3  hsa-miR-106a-5p      rep2 10.281767 10.731635 11.015216 10.892669 11.318908 11.262291 11.291289
4  hsa-miR-1180-3p      rep2  6.429934  6.276228  6.262570  7.008086  7.180922  7.272275  7.482902
5    hsa-miR-17-5p      rep2 10.789547 11.215104 11.481498 11.349497 11.734410 11.728679 11.754468
6   hsa-miR-188-5p      rep2  3.658422  4.300249  4.437543  4.355238  4.724906  4.721333  4.738676
7  hsa-miR-190a-5p      rep2  6.015720  6.799491  6.857382  6.782540  7.093815  7.343133  7.452283
8  hsa-miR-193b-3p      rep2  9.896313 10.350598 10.582272 10.445790 10.463917 10.312178 10.408284
9   hsa-miR-194-5p      rep2  4.793748  5.041048  5.551033  5.406860  5.518570  5.466202  5.752767
10  hsa-miR-20a-5p      rep2 11.558981 12.297440 12.740110 12.418584 12.872554 12.932491 13.054778
11  hsa-miR-26b-5p      rep2 11.025623 11.406470 11.411087 11.447918 11.781487 11.789555 11.991561
12   hsa-let-7d-5p      rep1 11.660549 11.623624 11.499499 11.515537 11.794755 11.899935 12.006919
13   hsa-let-7e-5p      rep1 10.732285 10.966696 10.942785 10.853484 11.072640 11.290014 11.360874
14 hsa-miR-106a-5p      rep1 10.150334 10.803837 11.015216 10.880317 11.209493 11.128817 11.102671
15 hsa-miR-1180-3p      rep1  6.659925  6.547303  6.344437  7.008086  7.201098  7.105820  7.554178
16   hsa-miR-17-5p      rep1 10.618934 11.248104 11.481498 11.365255 11.655924 11.622954 11.542105
17  hsa-miR-188-5p      rep1  3.912415  4.421633  4.602540  4.418567  4.437543  4.590268  4.793413
18 hsa-miR-190a-5p      rep1  5.647212  6.689800  6.857382  6.743050  7.341922  7.258910  7.022980
19 hsa-miR-193b-3p      rep1  9.970613 10.604389 10.660030 10.408284 10.283107 10.289418 10.435563
20  hsa-miR-194-5p      rep1  4.788720  4.898719  5.280973  5.466202  5.519581  5.699824  5.686831
21  hsa-miR-20a-5p      rep1 11.556679 12.387991 12.921077 12.710610 13.188627 13.050555 12.740110
22  hsa-miR-26b-5p      rep1 11.011856 11.447918 11.392888 11.401004 11.808608 11.689950 11.779471

data.m <- melt(data,id.vars=c("Replicate","miRNA"))
ggplot(data.m,aes(variable,value,colour=Replicate)) + geom_point() 
1

1 Answers

1
votes

I suppose you would like to see something like this:

data.m$group <- paste(data.m$Replicate, data.m$miRNA)
ggplot(data.m,aes(variable,value,colour=Replicate)) + 
  geom_point() + 
  geom_path(aes(group=group))

enter image description here