|
From: Charleux L. <lud...@gm...> - 2012-10-03 16:48:00
|
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> |