Reputation: 680
In R I want to plot say these vectors in one plot.
a <- c(1,2,5,4)
b <- c(10,2,3,4)
d <- c(5,4,6,8)
To plot these I type
plot(a, col="blue")
points(b, col="green")
points(d, col="orange")
Now I get not all points and that is confusing. The plot is simply not 'big' enough to capture all points. Is there a way to solve this ?
Upvotes: 0
Views: 183
Reputation: 3678
You can use matplot
:
m<-cbind(a,b,d)
matplot(m,type='l',col=c('blue','green','orange'),lty=1,lwd=1)
An other option is to specify the limits of the y-axis :
plot(a, col="blue",ylim=c(0,10))
points(b, col="green")
points(d, col="orange")
You can of course change the type of lines, width, labels, ... for both options.
Upvotes: 4