how to create several lines plot in r -


let's have x1=c(6,3,5,4,3,7) , x2=c(5,2,1,7,5,2) , want create plot like:

enter image description here

where x axis x1 , x2 , y axis corresponding value. how can in r? thx

plot(1, 1, xlim = c(1,2),      ylim = range(c(x1, x2)), type = "n", xaxt = "n") axis(side = 1, @ = 1:2, labels = 1:2) segments(x0 = 1, y0 = x1, x1 = 2, y1 = x2) points(x = rep(1, length(x1)), y = x1) points(x = rep(2, length(x2)), y = x2) 

enter image description here


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -