[R] how to plot multi- lines on one diagram

Chuck Cleland ccleland at optonline.net
Sun Feb 22 21:18:51 CET 2004


liu qin wrote:
> I got a matrix as data1, I do need to plot each column
> and illustrate them as 4 lines on the same screen.
> 
> Would anybody help me out please?
> 
>>data1
> 
>        [,1]  [,2]  [,3]   [,4]
>  [1,] 94.35 60.89 33.12 0.1001     	
>  [2,] 94.17 60.53 32.76 0.1003			
>  [3,] 94.35 61.80 34.74 0.0980
>  [4,] 95.45 65.99 38.74 0.0910
>  [5,] 95.82 69.44 38.38 0.0859
>  [6,] 95.64 68.72 42.19 0.0903
>  [7,] 94.35 69.28 43.11 0.2931
>  [8,] 94.19 68.73 43.27 0.0980
>  [9,] 93.82 65.81 38.36 0.1357
>  [10,] 92.90 63.81 39.28 0.1353	
> 

matplot(data1, type="l")

See ?matplot

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list