[R] 'matplot' for matrix with NAs: broken lines

Tao Shi shitao at hotmail.com
Wed May 5 20:30:44 CEST 2010


Hi list,

I know that points involving NAs are not plotted in 'matplot', but when I plot them as lines, I still want the lines to connect all the points (i.e. not broken where there are NAs).  Please see the example below.  How can I achieve this in 'matplot'?  If I can't, any good alternatives so I don't have to use 'plot' + 'lines' and loop through all the columns.

Many thanks!

...Tao

> set.seed(1234)
> a=b=matrix(rnorm(9), 3,3)
> b[2,2]=NA
> matplot(a, type="b")
> matplot(b, type="b")  ## I want the two "2" connected!
> matplot(b, type="l")  ## Now my data for the second column are missing from the graph
  
 		 	   		  
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.

N:WL:en-US:WM_HMP:042010_2


More information about the R-help mailing list