|
From: Matthew T. <tsc...@gm...> - 2008-09-18 06:23:24
|
I worked around this using masked arrays from numpy.ma. import numpy.ma as ma import pylab as pl import numpy as np x = ... x = ma.masked_where(np.isnan(x), x) pl.plot(x) pl.show() On Wed, Sep 17, 2008 at 6:36 PM, Goyo <goy...@gm...> wrote: > I'm having trouble plotting data with NaN values. My plot has lines and > markers and usually both are skipped for NaN values. But when I have > more than 127 data a line is drawn from the last non-NaN to the next. > > I read somewhere about a similar issue (maybe here? sorry I can't find > it just now), it seems like it has to do with some optimization > performed for large datasets and the use if lineto instead of moveto or > something like that. It was supposed to be fixed in 0.98.2 but I'm using > 0.98.3 from Benjamin Drung's PPA (http://ppa.launchpad.net/bdrung). > > This code shows the difference between plotting 127 and 128 data (look > at the left of each figure): > > import pylab as pl > x = pl.random(128) > x[4:7] = pl.NaN > y = x[:-1] > pl.figure(1) > pl.plot(x, '-o') > pl.grid(True) > pl.figure(2) > pl.plot(y, '-o') > pl.grid(True) > pl.show() > > Is this a known issue? Is there any workaround? > > Thanks > > Goyo > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |