From tcaswell at gmail.com Tue Dec 6 00:38:27 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 06 Dec 2016 05:38:27 +0000 Subject: [Matplotlib-users] [REL] matplotlib v2.0.0rc1 Message-ID: Folks, We are happy to announce matplotlib v2.0.0rc1 ! This is the first release candidate for the long awaited v2.0 release. For the full details of what is new please see http://matplotlib.org/2.0.0rc1/users/whats_new.html . Some of the highlights: - new default styles ( http://matplotlib.org/2.0.0rc1/users/dflt_style_changes.html ) - default font include most western alphabets - performance improvements in text and image rendering - vastly improved log scale ticks - many bug fixes and documentation improvements Please help us by testing the release candidate. To make this easy we have provided both wheels and conda packages for mac, linux and windows. You can install pre-releases via pip: pip install --pre matplotlib or via conda: conda install -c conda-forge/label/rc -c conda-forge matplotlib For more details see http://matplotlib.org/style_changes.html . Please report any issues to https://github.com/matplotlib/matplotlib/issues or matplotlib-users at python.org . The target for v2.0 final is around late Dec 2016/early Jan 2017. We anticipate there being at least 1 more release candidate. This release is the work of over 200 individual code contributors and many more who took part in the discussions, tested the beta releases, and reported bug reports. Thank you to everyone who contributed! Tom ps As of sending this email we are still waiting on the mac conda packages to finish building, (see https://travis-ci.org/conda-forge/matplotlib-feedstock/builds/181541792) Should be done in the next few hours, but I want to go to bed ;) -------------- next part -------------- An HTML attachment was scrubbed... URL: From arsh840 at gmail.com Sun Dec 11 04:42:40 2016 From: arsh840 at gmail.com (A.S. Khangura) Date: Sun, 11 Dec 2016 15:12:40 +0530 Subject: [Matplotlib-users] Create custom plot Message-ID: I want to create custom plot using Matplotlib. Here is image:https://www.dropbox.com/s/vabbluhkhwflg8k/mat.png Please let me know what kind of approach I should go for to generate such plot? -- Thanks Arshpreet Singh Python Developer Web Development/Data Science/Systems Integration Mobile: (91)987 6458 387 https://www.linkedin.com/in/arsh840 Doing what you like Freedom, Liking what you do is happiness. From pmhobson at gmail.com Mon Dec 12 09:43:30 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Mon, 12 Dec 2016 06:43:30 -0800 Subject: [Matplotlib-users] Create custom plot In-Reply-To: References: Message-ID: First, create instances of a figure and axes: import matplotlib.pyplot as plt fig, ax = plt.subplots() Then plot your data ax.plot(x, y, linestyle='-', color='black', linewidth=2) Then plot your threshold value: ax.axhline(y=threshold, linestyle='--', linewidth=1.5, color='black', alpha=0.75) Then label your axes: ax.set_xlabel('frequency') On Sun, Dec 11, 2016 at 1:42 AM, A.S. Khangura wrote: > I want to create custom plot using Matplotlib. > > Here is image:https://www.dropbox.com/s/vabbluhkhwflg8k/mat.png > > Please let me know what kind of approach I should go for to generate such > plot? > > -- > Thanks > Arshpreet Singh > Python Developer > Web Development/Data Science/Systems Integration > Mobile: (91)987 6458 387 > https://www.linkedin.com/in/arsh840 > > Doing what you like Freedom, Liking what you do is happiness. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Thu Dec 15 11:38:20 2016 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Thu, 15 Dec 2016 11:38:20 -0500 Subject: [Matplotlib-users] better plotting of magnetic field lines Message-ID: Hi all, I would like to plot the magnetic field lines for a simulation and am finding that streamplot is in adequate in a few ways. First, it breaks lines when they get too close together. I think this can be configured with the density parameter. More fundamentally, one usually wants the density of field lines to indicate the strength of the magnetic field. So a clever selection of start_points could in principle accomplish this, I think. That may be the way I go, but I wonder if someone hasn't already come up with a solution for this. If so, I'd love to hear about it. Regards, Jon -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From nathan12343 at gmail.com Thu Dec 15 11:41:51 2016 From: nathan12343 at gmail.com (Nathan Goldbaum) Date: Thu, 15 Dec 2016 10:41:51 -0600 Subject: [Matplotlib-users] better plotting of magnetic field lines In-Reply-To: References: Message-ID: yt uses an implementation of the line integral convolution recipe from scipy that works very nicely (IMO): http://yt-project.org/docs/dev/visualizing/callbacks.html#overplot-line-integral-convolution I don't think there's an easy way to do this with pure matplotlib right now, but you can take a look at yt's implementation if you're curious: https://bitbucket.org/yt_analysis/yt/src/011cd19563215cefb3facfd5d6f575b6b38de0db/yt/visualization/plot_modifications.py?at=yt&fileviewer=file-view-default#plot_modifications.py-2347 https://bitbucket.org/yt_analysis/yt/src/011cd19563215cefb3facfd5d6f575b6b38de0db/yt/utilities/lib/line_integral_convolution.pyx?at=yt&fileviewer=file-view-default On Thu, Dec 15, 2016 at 10:38 AM, Slavin, Jonathan wrote: > Hi all, > > I would like to plot the magnetic field lines for a simulation and am > finding that streamplot is in adequate in a few ways. First, it breaks > lines when they get too close together. I think this can be configured > with the density parameter. More fundamentally, one usually wants the > density of field lines to indicate the strength of the magnetic field. So > a clever selection of start_points could in principle accomplish this, I > think. That may be the way I go, but I wonder if someone hasn't already > come up with a solution for this. If so, I'd love to hear about it. > > Regards, > Jon > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Thu Dec 15 12:00:19 2016 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Thu, 15 Dec 2016 12:00:19 -0500 Subject: [Matplotlib-users] better plotting of magnetic field lines In-Reply-To: References: Message-ID: Thanks Nathan. I'll check it out. Jon On Thu, Dec 15, 2016 at 11:41 AM, Nathan Goldbaum wrote: > yt uses an implementation of the line integral convolution recipe from > scipy that works very nicely (IMO): > > http://yt-project.org/docs/dev/visualizing/callbacks. > html#overplot-line-integral-convolution > > I don't think there's an easy way to do this with pure matplotlib right > now, but you can take a look at yt's implementation if you're curious: > > https://bitbucket.org/yt_analysis/yt/src/011cd19563215cefb3facfd5d6f575 > b6b38de0db/yt/visualization/plot_modifications.py?at=yt& > fileviewer=file-view-default#plot_modifications.py-2347 > > https://bitbucket.org/yt_analysis/yt/src/011cd19563215cefb3facfd5d6f575 > b6b38de0db/yt/utilities/lib/line_integral_convolution.pyx? > at=yt&fileviewer=file-view-default > > On Thu, Dec 15, 2016 at 10:38 AM, Slavin, Jonathan < > jslavin at cfa.harvard.edu> wrote: > >> Hi all, >> >> I would like to plot the magnetic field lines for a simulation and am >> finding that streamplot is in adequate in a few ways. First, it breaks >> lines when they get too close together. I think this can be configured >> with the density parameter. More fundamentally, one usually wants the >> density of field lines to indicate the strength of the magnetic field. So >> a clever selection of start_points could in principle accomplish this, I >> think. That may be the way I go, but I wonder if someone hasn't already >> come up with a solution for this. If so, I'd love to hear about it. >> >> Regards, >> Jon >> >> -- >> ________________________________________________________ >> Jonathan D. Slavin Harvard-Smithsonian CfA >> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >> phone: (617) 496-7981 Cambridge, MA 02138-1516 >> cell: (781) 363-0035 USA >> ________________________________________________________ >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Fri Dec 16 08:14:44 2016 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Fri, 16 Dec 2016 08:14:44 -0500 Subject: [Matplotlib-users] better plotting of magnetic field lines In-Reply-To: References: Message-ID: Hi Nathan, That's interesting but not quite what I had in mind. See the attached figure to see what I'm looking for. I created that by using uniformly spaced start_points along the upper boundary of the plot. The only problem then is that I need to use the negative of Bx and By to get the field lines to get propagated in the correct directions. And then the arrows are in the wrong direction. One thought I had was to do this, get the output streamlines and then use the end points of those streamlines for start points. However it's not clear to me how to get those end points from the LineCollection that is part of the StreamplotSet container that's returned by streamplot. I can get segments from the LineCollection, but I don't know how to get the line endpoint out of those. Do you know how to do that? Jon On Thu, Dec 15, 2016 at 12:00 PM, Slavin, Jonathan wrote: > Thanks Nathan. I'll check it out. > > Jon > > On Thu, Dec 15, 2016 at 11:41 AM, Nathan Goldbaum > wrote: > >> yt uses an implementation of the line integral convolution recipe from >> scipy that works very nicely (IMO): >> >> http://yt-project.org/docs/dev/visualizing/callbacks.html# >> overplot-line-integral-convolution >> >> I don't think there's an easy way to do this with pure matplotlib right >> now, but you can take a look at yt's implementation if you're curious: >> >> https://bitbucket.org/yt_analysis/yt/src/011cd19563215cefb3f >> acfd5d6f575b6b38de0db/yt/visualization/plot_ >> modifications.py?at=yt&fileviewer=file-view-default#plot_ >> modifications.py-2347 >> >> https://bitbucket.org/yt_analysis/yt/src/011cd19563215cefb3f >> acfd5d6f575b6b38de0db/yt/utilities/lib/line_integral_ >> convolution.pyx?at=yt&fileviewer=file-view-default >> >> On Thu, Dec 15, 2016 at 10:38 AM, Slavin, Jonathan < >> jslavin at cfa.harvard.edu> wrote: >> >>> Hi all, >>> >>> I would like to plot the magnetic field lines for a simulation and am >>> finding that streamplot is in adequate in a few ways. First, it breaks >>> lines when they get too close together. I think this can be configured >>> with the density parameter. More fundamentally, one usually wants the >>> density of field lines to indicate the strength of the magnetic field. So >>> a clever selection of start_points could in principle accomplish this, I >>> think. That may be the way I go, but I wonder if someone hasn't already >>> come up with a solution for this. If so, I'd love to hear about it. >>> >>> Regards, >>> Jon >>> >>> -- >>> ________________________________________________________ >>> Jonathan D. Slavin Harvard-Smithsonian CfA >>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>> cell: (781) 363-0035 USA >>> ________________________________________________________ >>> >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >>> >> > > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Bmag_w_fieldlines.png Type: image/png Size: 261372 bytes Desc: not available URL: From i at introo.me Sat Dec 17 08:18:18 2016 From: i at introo.me (Shiyao Ma) Date: Sat, 17 Dec 2016 21:18:18 +0800 Subject: [Matplotlib-users] Why axes is not visible when used with figure.add_axes ? Message-ID: Hi, I have the following snippet to reproduce my problem: import numpy as np import matplotlib.pyplot as plt y = np.arange(4) x = np.arange(4) fig = plt.figure() ax = fig.add_axes([0, 0, 1, 1]) ax.plot(x, y) ax.set_title('test') ax.set_xlabel("XX") plt.show() The picture is here: http://imgur.com/a/1fh3u Why are the X/Y axes, the title, and the label not visible? Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From silva at lma.cnrs-mrs.fr Sat Dec 17 08:29:30 2016 From: silva at lma.cnrs-mrs.fr (Fabrice Silva) Date: Sat, 17 Dec 2016 14:29:30 +0100 Subject: [Matplotlib-users] Why axes is not visible when used with figure.add_axes ? In-Reply-To: References: Message-ID: <1481981370.1407.3.camel@lma.cnrs-mrs.fr> Le samedi 17 d?cembre 2016, Shiyao Ma a ?crit : > Hi, > > I have the following snippet to reproduce my problem: > > > import numpy as np > import matplotlib.pyplot as plt > > y = np.arange(4) > x = np.arange(4) > > fig = plt.figure() > ax = fig.add_axes([0, 0, 1, 1]) > ax.plot(x, y) > ax.set_title('test') > ax.set_xlabel("XX") > plt.show() > > > The picture is here: > http://imgur.com/a/1fh3u > > > Why are the X/Y axes, the title, and the label not visible? The bounds you provided to the add_axes method specify that the axes?spans all the figure. In fact [0,0,1,1] means that - the lower left corner is at coordinate (0,0) of the figure canvas - it spans the full width and height (1,1) of the canvas. So that the ticklabels, labels and title are outside of the visible part of the figure. Reduce the bounds (or even use add_subplot(1,1,1)) to get a suitable axes. From tcaswell at gmail.com Wed Dec 21 00:06:49 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 21 Dec 2016 05:06:49 +0000 Subject: [Matplotlib-users] [REL] matplotlib 2.0.0rc2 Message-ID: Folks, We are happy to announce matplotlib v2.0.0rc2 ! Please re-distribute this widely. This is the final planned release candidate for the long awaited mpl v2.0 release. For the full details of what is new please see http://matplotlib.org/2.0.0rc2/users/whats_new.html Some of the highlights: - new default style (see http://matplotlib.org/2.0.0rc2/users/dflt_style_changes.html ) - new default color map (viridis) - default font includes most western alphabets - performance improvements in text and image rendering - many bug fixes and documentation improvements - many new rcparams Please help us by testing the release candidate! We would like to hear about any uses where the new defaults are significantly worse, any changes we failed to documents, or (as always) any bugs and regressions. To make this easy we have both wheels and conda packages for mac, linux and windows. You can install pre-releases via pip: pip install --pre matplotlib or via conda: conda update --all -c conda-forge conda install -c conda-forge/label/rc -c conda-forge matplotlib For more details see http://matplotlib.org/style_changes.html . Please report any issues to https://github.com/matplotlib/matplotlib/issues or matplotlib-users at python.org . The target for v2.0 final is early Jan 2017. This release is the work of over 200 individual code contributors and many more who took part in the discussions, tested the pre-releases, and reported bug reports. Thank you to everyone who contributed! Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From Nicolas.Rougier at inria.fr Thu Dec 22 11:44:47 2016 From: Nicolas.Rougier at inria.fr (Nicolas P. Rougier) Date: Thu, 22 Dec 2016 17:44:47 +0100 Subject: [Matplotlib-users] From Python to Numpy Message-ID: Dear all, I've just put online a (kind of) book on Numpy and more specifically about vectorization methods. It's not yet finished, has not been reviewed and it's a bit rough around the edges. But I think there are some material that can be interesting. I'm specifically happy with the boids example that show a nice combination of numpy and matplotlib strengths. Book is online at: http://www.labri.fr/perso/nrougier/from-python-to-numpy/ Sources are available at: https://github.com/rougier/from-python-to-numpy Comments/questions/fixes/ideas are of course welcome. Nicolas From v.fraticelli at wanadoo.fr Sat Dec 24 03:05:08 2016 From: v.fraticelli at wanadoo.fr (Vincent FRATICELLI) Date: Sat, 24 Dec 2016 09:05:08 +0100 (CET) Subject: [Matplotlib-users] Unable to keep multiples animations in a figure Message-ID: <932878831.1801.1482566708507.JavaMail.www@wwinf1d36> Hi (and sorry for my poor english), ? I am a French Physics teacher, beginning with Python. ? I would like to plot animations of magnetic field lines. In the future, my aim would be to control each animation with the mouse button. The plot would began at the first click and stop at the next one. For now, I simply try to plot two successives animations of field lines using funcAnimation. My problem is that the first animation is cleared when the second is plotted. How could I keep all in the figure ? If anyone could help ? Best regards, Vincent. ? Codes : Unable to find the solution, I have removed all the loops in the script and simply made a crude copy of the first part of the script to repeat the animation. But even this don't work ! **************************************************************************** import numpy as np from matplotlib import pyplot as plt from matplotlib import animation from scipy.integrate import odeint ? """Ce script anime progressivement une ligne de champ ? partir d'un point indiqu?""" ? fig = plt.figure() ax = plt.axes(xlim=(-1,1), ylim=(-1, 1)) ? L=np.linspace(0,1,100) plt.plot(L,L) ? y0=(0.2,0.1) line, = ax.plot([], [], lw=2) ? def animate(i): ? ? def F(y,t): ? ? ? ? ? ? ? ? dy=[0,0] ? ? ? ? dy[0]=y[1] ? ? ? ? dy[1]=-y[0] ? ? ? ? return dy ? ? ? ? ? t_min=0;t_max=10;dt=0.1 ? ? t = np.arange(t_min,i*t_max/20,dt) ? ?? ? ? y=odeint(F,y0,t) ? ? line.set_data(y[:,0],y[:,1]) ? ? return line, ? anim = animation.FuncAnimation(fig, animate,frames=10,repeat=0) ? # Bloc suivant identique au premier avec y0 diff?rent # Son ex?cution efface la premi?re ligne ? """y0=(0.8,0.1) line2, = ax.plot([], [], lw=2) def animate2(i): ? ? def F(y,t): ? ? ? ? ? ? ? ? dy=[0,0] ? ? ? ? dy[0]=y[1] ? ? ? ? dy[1]=-y[0] ? ? ? ? return dy ? ? ? ? ? t_min=0;t_max=10;dt=0.1 ? ? t = np.arange(t_min,i*t_max/20,dt) ? ?? ? ? y=odeint(F,y0,t) ? ? line2.set_data(y[:,0],y[:,1]) ? ? return line2, ? anim2 = (animation.FuncAnimation(fig, animate2,frames=10,repeat=0)) """ plt.show() -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Sat Dec 24 10:27:09 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Sat, 24 Dec 2016 10:27:09 -0500 Subject: [Matplotlib-users] Unable to keep multiples animations in a figure In-Reply-To: <932878831.1801.1482566708507.JavaMail.www@wwinf1d36> References: <932878831.1801.1482566708507.JavaMail.www@wwinf1d36> Message-ID: Vincent, I am away from my computer for the week, so my help will be limited. In my book, Interactive Applications using Matplotlib, I devote chapter 3 to the animation module. While I don't outline how one can do what you are asking for, I do detail how animations are triggered and controlled under-the-hood. Perhaps it can provide some inspirations? Ben Root On Dec 24, 2016 3:12 AM, "Vincent FRATICELLI" wrote: > Hi (and sorry for my poor english), > > > > I am a French Physics teacher, beginning with Python. > > > > I would like to plot animations of magnetic field lines. In the future, my > aim would be to control each animation with the mouse button. The plot > would began at the first click and stop at the next one. > > For now, I simply try to plot two successives animations of field lines > using funcAnimation. My problem is that the first animation is cleared when > the second is plotted. How could I keep all in the figure ? > > If anyone could help ? > > Best regards, Vincent. > > > > Codes : > > Unable to find the solution, I have removed all the loops in the script > and simply made a crude copy of the first part of the script to repeat the > animation. But even this don't work ! > > ************************************************************ > **************** > > import numpy as np > > from matplotlib import pyplot as plt > > from matplotlib import animation > > from scipy.integrate import odeint > > > > """Ce script anime progressivement une ligne de champ ? partir d'un point > indiqu?""" > > > > fig = plt.figure() > > ax = plt.axes(xlim=(-1,1), ylim=(-1, 1)) > > > > L=np.linspace(0,1,100) > > plt.plot(L,L) > > > > y0=(0.2,0.1) > > line, = ax.plot([], [], lw=2) > > > > def animate(i): > > def F(y,t): > > dy=[0,0] > > dy[0]=y[1] > > dy[1]=-y[0] > > return dy > > > > t_min=0;t_max=10;dt=0.1 > > t = np.arange(t_min,i*t_max/20,dt) > > y=odeint(F,y0,t) > > line.set_data(y[:,0],y[:,1]) > > return line, > > > > anim = animation.FuncAnimation(fig, animate,frames=10,repeat=0) > > > > # Bloc suivant identique au premier avec y0 diff?rent > > # Son ex?cution efface la premi?re ligne > > > > """y0=(0.8,0.1) > > line2, = ax.plot([], [], lw=2) > > def animate2(i): > > def F(y,t): > > dy=[0,0] > > dy[0]=y[1] > > dy[1]=-y[0] > > return dy > > > > t_min=0;t_max=10;dt=0.1 > > t = np.arange(t_min,i*t_max/20,dt) > > y=odeint(F,y0,t) > > line2.set_data(y[:,0],y[:,1]) > > return line2, > > > > anim2 = (animation.FuncAnimation(fig, animate2,frames=10,repeat=0)) > > """ > > plt.show() > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From v.fraticelli at wanadoo.fr Sat Dec 24 11:16:13 2016 From: v.fraticelli at wanadoo.fr (Vincent FRATICELLI) Date: Sat, 24 Dec 2016 17:16:13 +0100 (CET) Subject: [Matplotlib-users] Unable to keep multiples animations in a figure In-Reply-To: References: <932878831.1801.1482566708507.JavaMail.www@wwinf1d36> Message-ID: <670906562.6611.1482596173245.JavaMail.www@wwinf1j22> Hi Ben, Thanks for the help. I keep coding as with the Fortran of my youth and some good modern books would be useful !? Merry christmas, Vincent. ? ? ? ? > Message du 24/12/16 16:27 > De : "Benjamin Root" > A : "Vincent FRATICELLI" > Copie ? : "Matplotlib-users" > Objet : Re: [Matplotlib-users] Unable to keep multiples animations in a figure > > Vincent, > I am away from my computer for the week, so my help will be limited. In my book, Interactive Applications using Matplotlib, I devote chapter 3 to the animation module. While I don't outline how one can do what you are asking for, I do detail how animations are triggered and controlled under-the-hood. Perhaps it can provide some inspirations? > Ben Root > > On Dec 24, 2016 3:12 AM, "Vincent FRATICELLI" wrote: > Hi (and sorry for my poor english), > ? > I am a French Physics teacher, beginning with Python. > ? > I would like to plot animations of magnetic field lines. In the future, my aim would be to control each animation with the mouse button. The plot would began at the first click and stop at the next one. > For now, I simply try to plot two successives animations of field lines using funcAnimation. My problem is that the first animation is cleared when the second is plotted. How could I keep all in the figure ? > If anyone could help ? > Best regards, Vincent. > ? > Codes : > Unable to find the solution, I have removed all the loops in the script and simply made a crude copy of the first part of the script to repeat the animation. But even this don't work ! > **************************************************************************** > import numpy as np > from matplotlib import pyplot as plt > from matplotlib import animation > from scipy.integrate import odeint > ? > """Ce script anime progressivement une ligne de champ ? partir d'un point indiqu?""" > ? > fig = plt.figure() > ax = plt.axes(xlim=(-1,1), ylim=(-1, 1)) > ? > L=np.linspace(0,1,100) > plt.plot(L,L) > ? > y0=(0.2,0.1) > line, = ax.plot([], [], lw=2) > ? > def animate(i): > ? ? def F(y,t): ? ? ? ? > ? ? ? ? dy=[0,0] > ? ? ? ? dy[0]=y[1] > ? ? ? ? dy[1]=-y[0] > ? ? ? ? return dy ? ? > ? > ? ? t_min=0;t_max=10;dt=0.1 > ? ? t = np.arange(t_min,i*t_max/20,dt) ? ?? > ? ? y=odeint(F,y0,t) > ? ? line.set_data(y[:,0],y[:,1]) > ? ? return line, > ? > anim = animation.FuncAnimation(fig, animate,frames=10,repeat=0) > ? > # Bloc suivant identique au premier avec y0 diff?rent > # Son ex?cution efface la premi?re ligne > ? > """y0=(0.8,0.1) > line2, = ax.plot([], [], lw=2) > def animate2(i): > ? ? def F(y,t): ? ? ? ? > ? ? ? ? dy=[0,0] > ? ? ? ? dy[0]=y[1] > ? ? ? ? dy[1]=-y[0] > ? ? ? ? return dy ? ? > ? > ? ? t_min=0;t_max=10;dt=0.1 > ? ? t = np.arange(t_min,i*t_max/20,dt) ? ?? > ? ? y=odeint(F,y0,t) > ? ? line2.set_data(y[:,0],y[:,1]) > ? ? return line2, > ? > anim2 = (animation.FuncAnimation(fig, animate2,frames=10,repeat=0)) > """ > plt.show() > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From 39256912 at qq.com Tue Dec 6 08:50:59 2016 From: 39256912 at qq.com (fbjoker) Date: Tue, 06 Dec 2016 13:50:59 -0000 Subject: [Matplotlib-users] About three dimensional slices Message-ID: <1481031229415-47652.post@n5.nabble.com> Hello, I want to ask the Matplotlib have such a module can achieve the following results? -- View this message in context: http://matplotlib.1069221.n5.nabble.com/About-three-dimensional-slices-tp47652.html Sent from the matplotlib - users mailing list archive at Nabble.com. From peter.leitner at uni-graz.at Wed Dec 7 11:59:56 2016 From: peter.leitner at uni-graz.at (rwleo) Date: Wed, 07 Dec 2016 16:59:56 -0000 Subject: [Matplotlib-users] Plotting boundaries of segmented data Message-ID: <1481129994931-47655.post@n5.nabble.com> Hello, I am trying to plot a 2-D array with segmentation data from a fluid flow. The data structure is continuous which means that the segments are connected regions, like in the picture below: I use plt.imshow(seg, cmap="Greys") which returns a black area on a white background. What I would like to achieve instead is to plot only the boundary as a black curve, like when plotting a shape with pylab setting edgecolor=black and facecolor=white. Unfortunately, having the data in matrix format I am not sure whether this can easily be achieved without writing a separate function that detects whether a pixel belongs to the border or the interior. Is there an alternative to the imshow function which does this simply by setting some keywords? Secondly I would like to smoothen the boundary curve which looks quite "rectangular" due to the coarse segmentation algorithm that has been applied to the fluid flow data. Can this be done with interp2d, if the segments are not based on an analytical expression? Many thanks in advance! -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-boundaries-of-segmented-data-tp47655.html Sent from the matplotlib - users mailing list archive at Nabble.com. From josh at devlinsonline.com.au Wed Dec 7 16:34:40 2016 From: josh at devlinsonline.com.au (Joshua Devlin) Date: Wed, 07 Dec 2016 21:34:40 -0000 Subject: [Matplotlib-users] Fwd: Issue with Basemap and drawcounties() In-Reply-To: References: Message-ID: Code which I'm trying to plot inside a Jupyter notebook: %matplotlib inline from mpl_toolkits.basemap import Basemap m = Basemap(projection="merc", llcrnrlat=38.8, llcrnrlon=-76, urcrnrlat=42, urcrnrlon=-72.5, resolution='i') m.drawcoastlines(linewidth=.25) m.drawcountries(linewidth=.25) m.drawstates(linewidth=.2) m.drawcounties(linewidth=.1) The error I get is: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 2: invalid continuation byte Which is exactly the same as in this GitHub Issue (which isn?t mine): https://github.com/matplotlib/basemap/issues/324 I?m running MPL 1.5.3, does anyone have any clues on how I might troubleshoot this? ? Joshua Devlin M: +1 832 266 2564 <(832)%20266-2564> E: joshuadevlin at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From josh at devlinsonline.com.au Wed Dec 7 17:49:25 2016 From: josh at devlinsonline.com.au (Joshua Devlin) Date: Wed, 07 Dec 2016 22:49:25 -0000 Subject: [Matplotlib-users] Fwd: Issue with Basemap and drawcounties() In-Reply-To: References: Message-ID: Code which I'm trying to plot inside a Jupyter notebook: %matplotlib inline from mpl_toolkits.basemap import Basemap m = Basemap(projection="merc", llcrnrlat=38.8, llcrnrlon=-76, urcrnrlat=42, urcrnrlon=-72.5, resolution='i') m.drawcoastlines(linewidth=.25) m.drawcountries(linewidth=.25) m.drawstates(linewidth=.2) m.drawcounties(linewidth=.1) The error I get is: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 2: invalid continuation byte Which is exactly the same as in this GitHub Issue (which isn?t mine): https://github.com/matplotlib/basemap/issues/324 I?m running MPL 1.5.3, does anyone have any clues on how I might troubleshoot this? ? Joshua Devlin M: +1 832 266 2564 <(832)%20266-2564> E: joshuadevlin at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From 39256912 at qq.com Wed Dec 7 20:24:33 2016 From: 39256912 at qq.com (=?gb18030?B?trm4rw==?=) Date: Thu, 08 Dec 2016 01:24:33 -0000 Subject: [Matplotlib-users] About 3 dimensional slices Message-ID: Hello, I want to ask the Matplotlib how to slice the 3D data. for example(matlab)? slice(x,y,z,v,xslice,yslice,zslice) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 8DA9BC0F at EFD15B51.8FB24858.jpg Type: image/jpeg Size: 66501 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: InterpolateUsingDefaultMethodExample_01.png Type: application/octet-stream Size: 35961 bytes Desc: not available URL: From arsh840 at gmail.com Sun Dec 11 04:34:56 2016 From: arsh840 at gmail.com (A.S. Khangura) Date: Sun, 11 Dec 2016 09:34:56 -0000 Subject: [Matplotlib-users] Create custom Plot Message-ID: I want to create custom plot using Matplotlib. Here is image:https://www.dropbox.com/s/vabbluhkhwflg8k/mat.png Please let me know what kind of approach I should go for to generate such plot? -- Thanks Arshpreet Singh Python Developer Web Development/Data Science/Systems Integration Mobile: (91)987 6458 387 https://www.linkedin.com/in/arsh840 Doing what you like Freedom, Liking what you do is happiness. From mauriziodepitta at gmail.com Sun Dec 18 09:41:10 2016 From: mauriziodepitta at gmail.com (=?UTF-8?Q?Maurizio_De_Pitt=C3=A0?=) Date: Sun, 18 Dec 2016 14:41:10 -0000 Subject: [Matplotlib-users] Stacked 2D plots with interconnections in Matplotlib Message-ID: Fedora 20; Python 2.7.5; Matplotlib 1.4.3 (installed by yum/pip) I need to visualize some complex multivariate datasets and the preferred way is to use a modification of parallel axis visualization, using stacked 2D plots, where each plot maps a degree of freedom/model parameter and data points belonging to the same data sets should be interconnected across different plots. I am attaching a conceptual sketch. I put emphasis that each plane should be a plot itself with its own axes with their own scales. More specifically, all plots have the same x-axis, but the y-axis represents something different. Any idea of how to implement it by matplotlib? Cheers, M -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: stack_plot.png Type: image/png Size: 25181 bytes Desc: not available URL: From mauriziodepitta at gmail.com Wed Dec 21 15:57:16 2016 From: mauriziodepitta at gmail.com (=?UTF-8?Q?Maurizio_De_Pitt=C3=A0?=) Date: Wed, 21 Dec 2016 20:57:16 -0000 Subject: [Matplotlib-users] python connect points between different 3d plots Message-ID: Hi folks, is there a way akin of patches.ConnectionPatch that also work in 3D plots: namely I would like to connect points of different 3D plots. How can I do that? Cheers, M -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris.barker at noaa.gov Thu Dec 22 14:16:29 2016 From: chris.barker at noaa.gov (Chris Barker) Date: Thu, 22 Dec 2016 19:16:29 -0000 Subject: [Matplotlib-users] [Numpy-discussion] From Python to Numpy In-Reply-To: References: Message-ID: Nicolas, >From a quick glance, this looks really wonderful! I intend to point my students that are interested in numpy to it. -CHB On Thu, Dec 22, 2016 at 8:44 AM, Nicolas P. Rougier < Nicolas.Rougier at inria.fr> wrote: > > Dear all, > > I've just put online a (kind of) book on Numpy and more specifically about > vectorization methods. It's not yet finished, has not been reviewed and > it's a bit rough around the edges. But I think there are some material that > can be interesting. I'm specifically happy with the boids example that show > a nice combination of numpy and matplotlib strengths. > > Book is online at: http://www.labri.fr/perso/ > nrougier/from-python-to-numpy/ > Sources are available at: https://github.com/rougier/from-python-to-numpy > > > Comments/questions/fixes/ideas are of course welcome. > > > Nicolas > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion at scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion > -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov -------------- next part -------------- An HTML attachment was scrubbed... URL: From kikocorreoso at gmail.com Fri Dec 23 03:14:23 2016 From: kikocorreoso at gmail.com (Kiko) Date: Fri, 23 Dec 2016 08:14:23 -0000 Subject: [Matplotlib-users] [Numpy-discussion] From Python to Numpy In-Reply-To: References: Message-ID: 2016-12-22 17:44 GMT+01:00 Nicolas P. Rougier : > > Dear all, > > I've just put online a (kind of) book on Numpy and more specifically about > vectorization methods. It's not yet finished, has not been reviewed and > it's a bit rough around the edges. But I think there are some material that > can be interesting. I'm specifically happy with the boids example that show > a nice combination of numpy and matplotlib strengths. > > Book is online at: http://www.labri.fr/perso/ > nrougier/from-python-to-numpy/ > Sources are available at: https://github.com/rougier/from-python-to-numpy > > > Comments/questions/fixes/ideas are of course welcome. > Wow!!! Beautiful. Thanks for sharing. > > > Nicolas > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion at scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.rogozhnikov at yandex.ru Fri Dec 30 14:37:46 2016 From: alex.rogozhnikov at yandex.ru (Alex Rogozhnikov) Date: Fri, 30 Dec 2016 19:37:46 -0000 Subject: [Matplotlib-users] [Numpy-discussion] From Python to Numpy In-Reply-To: References: Message-ID: Hi Nicolas, that's a very nice work! > Comments/questions/fixes/ideas are of course welcome. Boids example brought my attention too, some comments on it: - I find using complex numbers here very natural, this should speed up things and also shorten the code (rotating without einsum, etc.) - you probably can speed up things with going to sparse arrays - and you can go to really large numbers of 'birds' if you combine it with preliminary splitting of space into squares, thus analyze only birds from close squares Also I think worth adding some operations with HSV / HSL color spaces as those can be visualized easily e.g. on some photo. Thanks, Alex. > 23 ???. 2016 ?., ? 12:14, Kiko ???????(?): > > > > 2016-12-22 17:44 GMT+01:00 Nicolas P. Rougier >: > > Dear all, > > I've just put online a (kind of) book on Numpy and more specifically about vectorization methods. It's not yet finished, has not been reviewed and it's a bit rough around the edges. But I think there are some material that can be interesting. I'm specifically happy with the boids example that show a nice combination of numpy and matplotlib strengths. > > Book is online at: http://www.labri.fr/perso/nrougier/from-python-to-numpy/ > Sources are available at: https://github.com/rougier/from-python-to-numpy > > > Comments/questions/fixes/ideas are of course welcome. > > Wow!!! Beautiful. > > Thanks for sharing. > > > > Nicolas > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion at scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion at scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion -------------- next part -------------- An HTML attachment was scrubbed... URL: