I would like to plot some point in r:
k<-c(540, 535, 545, 538, 530, 550, 544, 548)
m<-c(545, 536, 547, 540, 543)
for k
I want to have points from time 1 to 8 on X-axis (difference between tim on x-axis between points are same)
plot(k, lwd=2,col="blue",xlab="Time",ylab="Values",pch=16,type="b")
but for m
I would like to have this point on different time. For example on x-axis times (1,2,5,7,8) on the last plot with another color(red). How can I do that?
thanks alot
Could use par(new = TRUE)
, something like
plot(k, lwd=2,col="blue",xlab="",ylab="",pch=16,type="b")
par(new = TRUE)
plot(c(1,2,5,7,8), m, col="red",xlab="Time",ylab="Values",pch=16,type="b", yaxt = 'n')
Could also just use lines
instead
plot(k, lwd=2,col="blue",xlab="Time",ylab="Values",pch=16,type="b")
lines(c(1,2,5,7,8), m, col="red",pch=16, type="b")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.