|
From: Phil E. <pel...@gm...> - 2012-10-03 17:03:04
|
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, On 3 October 2012 17:47, Charleux Ludovic <lud...@gm...>wrote: > Hello Phil, > > Your example does not trigger the bug because you don't zoom or specifiy > xlim/ylim so that some points are (far) out of the current axis. For > example, if you just add these lines to your code, you'll have it: > > > import matplotlib.pyplot as plt > import numpy as np > x = np.array([0, 1, None, 1, 0]) > y = np.array([0, 1, None, 0, 1]) > plt.plot(x, y) > # Add this or zoom in the upper left corner. > plt.xlim([0., 0.2]) > plt.ylim([.9, 1.1]) > plt.show() > > Here I see an horizontal line where I should see a 45° tilted line. And > the nasty part of this bug is that it only affects lines declared with at > least one None in them where continuous lines seem unaffected as shown here: > > > import matplotlib.pyplot as plt > import numpy as np > x0 = np.array([0, 1]) > y0 = np.array([0, 1]) > x1 = np.array([1, 0]) > y1 = np.array([0, 1]) > plt.plot(x0, y0) > plt.plot(x1, y1) > # Add this > plt.xlim([0., 0.2]) > plt.ylim([.9, 1.1]) > plt.show() > > I get a 45° line. > > Ludovic > > ps: I use matplotlib 1.1.1rc (stock version available on repositories) on > Xubuntu 12.04 (precise) 64-bit > > > 2012/10/3 Phil Elson <pel...@gm...> > >> This works for me with 1.2 (not tested before that): >> >> >> import matplotlib.pyplot as plt >> import numpy as np >> >> >> x = np.array([0, 1, None, 1, 0]) >> y = np.array([0, 1, None, 0, 1]) >> >> plt.plot(x, y) >> >> plt.show() >> >> >> >> I get two distinct lines crossing each other at (0.5, 0.5) >> >> >> HTH, >> > > > > -- > > *Ludovic Charleux* > Assistant Professor > > *SYMME / Polytech' Annecy Chambery * > <http://www.polytech.univ-savoie.fr/index.php?id=symme_accueil&L=1> Domaine > Universitaire, BP 80439 > <http://maps.google.com/maps?q=Domaine+Universitaire%2C+BP+80439%2C+Annecy+le+vieux+cedex%2C+F74944%2C+France&hl=en>Annecy le vieux cedex, F74944 France > *Work:* 33 (0) 4 50 09 65 62 > *Fax:* 33 (0) 4 50 09 65 43 > *Email:* lud...@un... > *Professional Profile<http://fr.linkedin.com/pub/ludovic-charleux/22/611/997> > * > See who we know in common<http://www.linkedin.com/e/wwk/79152451/?hs=false&tok=1JhCnH2Q-kS5g1> Want > a signature like this?<http://www.linkedin.com/e/sig/79152451/?hs=false&tok=3gCpNtR8KkS5g1> > |