Plinth
Plinth

Reputation: 289

R -- Creating a matrix of line plots using pairs

Let's say I have some deterministic data:

a<-matrix(c(1:33,exp(1:33/11),(1:33)^2),nrow=33)

I want to plot the three columns of data against each other, so I choose to use pairs():

pairs(a)

This works well enough but I'd like line plots instead of scatter plots. So I try to put in the argument type='l' but I get an error:

pairs(a,type='l')

Error in plot.default(...) : 
  formal argument "type" matched by multiple actual arguments

What is going wrong? How would I be able to get the pictures as line plots instead of scatter plots using pairs()? Thank you!

Upvotes: 2

Views: 147

Answers (1)

Dave Gruenewald
Dave Gruenewald

Reputation: 5689

You want to use the panel arguement!

pairs(a, panel = lines)

You can further modify the output by exploring the arguments in the help section:

?pairs()

Upvotes: 3

Related Questions