# [R] RES: Multiple XY Lines Plot

Philipp Pagel p.pagel at wzw.tum.de
Tue Nov 11 21:01:50 CET 2008

```On Tue, Nov 11, 2008 at 05:11:05PM -0200, Rodrigo Aluizio wrote:
> Philipp you actually solved my problem when you mentioned matplot function.
> I hadn't read anything about it before, when you mentioned I searched and
> I'm getting what I need, now it's just a question of minor adjustments.
>
> Below is a simple solution that I will now improve.
>
> matplot(Perfil\$3.W,Perfil\$2.H,type='n',xlab='Length',ylab='Height')
> lines(Perfil\$1.W,Perfil\$1.H,lty='solid')
> lines(Perfil\$2.W,Perfil\$2.H,lty='dotted')
> lines(Perfil\$3.W,Perfil\$3.H,lty='dashed')
> lines(Perfil\$4.W,Perfil\$4.H,lty='dotdash')

Assuming Perfil is a data frame, you can do all of this in a
single matplot call. E.g.:

# prepare some example data
x <- 1:25
df <- data.frame(w1=x, w2=x+0.5, h1=x^2, h2=3*x+1.3)

# use matplot to graph all data at once
matplot(df[,c('w1','w2')], df[,c('h1','h2')], type='l', lty=c('solid', 'dotted'))

cu
Philipp

--
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

```