Fernando, Your example works as you describe on recent matplotlib versions. I suspect you are using an old one. The preferred way of handling missing points in numpy, and therefore in matplotlib and pylab, however, is via masked arrays.
import pylab import numpy as np from numpy import ma a = [1,2,3,4,5] b = np.array([6,2,np.nan,1,9]) bm = ma.masked_where(np.isnan(b), b) pylab.plot(a,bm) pylab.show() There are many other examples of masked array use in the examples directory of the matplotlib distribution. Eric Fernando Abilleira wrote: > Dear sourceforge community, > > I come from a Matlab environment so I am used to plotting matrices that > contain NaN elements. This is very useful because in some cases one > doesn't have data for the entire matrix. If one tries plotting the data, > the NaN elements won't be plotted. > > Is there a similar element type or workaround I could use to get the > same effect? > > In the following simple example: > > a = [1,2,3,4,5] > b = [6,2,NaN,1,9] > mpylab.plot(a,b) > > I would like to get two lines with a gap in between them at element [2]. > > Thanks for any help you can offer. > > Regards, > > Fernando ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users