On 2012/10/03 8:11 AM, Charleux Ludovic wrote: > Thanks for your multiple answers. I'll try the same manipulation with > the 1.2 version as soon as possible. Concerning the debate between the > use of None and numpy.nan, I tryed both methods before posting and they > both lead to the same bug on my version. I'm using the None/numpy.nan > trick to plot finite element 2D meshes (Matplotlib allows very neat > vectorial plots) and I often adjust xlim/ylim to magnify interesting > zones and so this bug is everywhere. I'm not totally sure but I think > the bug was not present in the 1.0.x versions I tested before.
Please--there is *no* None trick. This is not a debate. Please do *not* use None. Use np.nan or a masked array. Unless you go into the lower levels of the api, mpl will convert a floating-point array with nans into a masked array for operations such as auto-scaling. If you must use an object array (e.g., as Ben notes, if you are using datetime objects--it must be something for which there is a registered converter, because at the plotting level mpl works with floats), then make it a masked array if you need to put gaps in it. If that does not work, then it is a bug in the conversion process. Masked arrays should work for any input type supported by mpl. Eric > > Regards. > > Ludovic Charleux > > 2012/10/3 Benjamin Root <ben.r...@ou.edu <mailto:ben.r...@ou.edu>> > > > > On Wed, Oct 3, 2012 at 1:02 PM, Phil Elson <pelson....@gmail.com > <mailto:pelson....@gmail.com>> wrote: > > I don't get this on matplotlib/master (and therefore probably > not on 1.2rc2). > > I'm pretty sure masked array line plotting was fixed at some > point this release cycle (I cannot find the appropriate github > issue to link to), so I suggest this is a known bug with 1.1.1 > and fixed in 1.2. Just to be clear, I am using the TkAgg > backend, and there is a remote possiblity that this bug is > backend dependent. Is there any chance you could test this with > the latest release candidate? > > Many Thanks, > > > This issue may be dependent upon which version of Numpy one is > using. As Eric pointed out, one should be getting an object array > if you have a None in the list. On top of that, I wouldn't be > surprised if the different backends handled this object array > differently. > > As far as I am concerned, using None in the list is the bug and is > not only unsupported, but should be actively discouraged. Use NaNs > or masked arrays instead. > > (and to ward off the inevitable question, I would advise against > explicitly checking for object arrays because there are times when > it is correct to have such arrays, i.e., python decimal or datetime > objects). > > Cheers! > Ben Root > > > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users