From Nicolas.Rougier at inria.fr Mon May 7 01:51:06 2018 From: Nicolas.Rougier at inria.fr (Nicolas Rougier) Date: Mon, 7 May 2018 07:51:06 +0200 Subject: [Matplotlib-users] Book on scientific visualization using Python & OpenGL Message-ID: <34FFDB4C-C545-42F5-97CF-9B7098B10228@inria.fr> [Sorry for cross-posting] Hi all, I just released an (unfinished) book on "Python & OpenGL for Scientific Visualization?. It?s available at http://www.labri.fr/perso/nrougier/python-opengl/ (sources are available at https://github.com/rougier/python-opengl) Nicolas From projetmbc at gmail.com Mon May 7 02:14:13 2018 From: projetmbc at gmail.com (Christophe BAL (via GMAIL)) Date: Mon, 7 May 2018 08:14:13 +0200 Subject: [Matplotlib-users] Book on scientific visualization using Python & OpenGL In-Reply-To: <34FFDB4C-C545-42F5-97CF-9B7098B10228@inria.fr> References: <34FFDB4C-C545-42F5-97CF-9B7098B10228@inria.fr> Message-ID: <9bc957d7-0730-838c-0308-4a805429f201@gmail.com> That looks very, very interesting. Maybe the book I was looking for... Thanks for sharing. Le 07/05/2018 ? 07:51, Nicolas Rougier a ?crit?: > [Sorry for cross-posting] > > > Hi all, > > I just released an (unfinished) book on "Python & OpenGL for Scientific Visualization?. > It?s available at http://www.labri.fr/perso/nrougier/python-opengl/ > > (sources are available at https://github.com/rougier/python-opengl) > > > Nicolas > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users -- Christophe BAL Enseignant Agr?g? de Math?matiques Programmeur Python Amateur From wrw at mac.com Mon May 7 09:29:28 2018 From: wrw at mac.com (William Ray Wing) Date: Mon, 07 May 2018 09:29:28 -0400 Subject: [Matplotlib-users] Book on scientific visualization using Python & OpenGL In-Reply-To: <9bc957d7-0730-838c-0308-4a805429f201@gmail.com> References: <34FFDB4C-C545-42F5-97CF-9B7098B10228@inria.fr> <9bc957d7-0730-838c-0308-4a805429f201@gmail.com> Message-ID: <1226ABCC-CA7E-4C7F-BAA8-5F5FB75A730F@mac.com> > On May 7, 2018, at 2:14 AM, Christophe BAL (via GMAIL) wrote: > > That looks very, very interesting. Maybe the book I was looking for... > > Thanks for sharing. > +100 (And just in time too.) Bill > Le 07/05/2018 ? 07:51, Nicolas Rougier a ?crit : >> [Sorry for cross-posting] >> >> >> Hi all, >> >> I just released an (unfinished) book on "Python & OpenGL for Scientific Visualization?. >> It?s available at http://www.labri.fr/perso/nrougier/python-opengl/ >> >> (sources are available at https://github.com/rougier/python-opengl) >> >> >> Nicolas >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users > > -- > Christophe BAL > Enseignant Agr?g? de Math?matiques > Programmeur Python Amateur > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users From djpine at gmail.com Tue May 8 09:18:04 2018 From: djpine at gmail.com (David J Pine) Date: Tue, 8 May 2018 09:18:04 -0400 Subject: [Matplotlib-users] set_aspect('equal') for log-log plots Message-ID: <10BF06B5-2016-4CAB-A26C-FA39F7450C3C@gmail.com> I would like to make a log-log plot where the x and y axes have the same scale. That is, if a decade is one inch physically on the x axis, I want it to be one inch physically on the y axis. How do I do this? I tried set_aspect(?equal?) but it doesn?t work for logarithmic axes. This makes sense for semi-log plots but it doesn?t make sense for log-log plots, where it should work (logically). Is there some other straightforward way to do it? By the way, it would be nice if it worked when there are shared axes, as in the example below. import matplotlib.pyplot as plt import numpy as np xline = np.array([10, 1500]) yline = np.array([0.1, 15.]) ymin, ymax = 0.0001, 10. fig, ax = plt.subplots(figsize=(5, 8)) lines = np.array([2., 0.4, 0.08, 0.016, 0.0022]) for m in lines: ax.loglog(xline, m*yline, dashes=(5, 2)) ax.set_ylim(ymin, ymax) scale = 1.0e6 axR = ax.twinx() axR.set_ylim(ymin*scale, ymax*scale) axR.loglog([], []) ax.set_aspect('equal', share=True) # doesn't do anything plt.show() From heiland at iu.edu Tue May 8 11:28:19 2018 From: heiland at iu.edu (Heiland, Randy) Date: Tue, 8 May 2018 15:28:19 +0000 Subject: [Matplotlib-users] fixed colorbar position for repeated plots Message-ID: <3297A393-4FED-479B-B661-0F2E04F313EF@iu.edu> I have a script that lets a user step through and plot data in files and I want to fix the position, i.e. re-use, a single colorbar. How is this done? The following script illustrates the problem: # adapted from https://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html import matplotlib.pyplot as plt import numpy as np from numpy.random import randn fig, ax = plt.subplots() data = np.clip(randn(250, 250), -1, 1) cax = ax.imshow(data, interpolation='nearest') cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) data = np.clip(randn(250, 250), -1, 1) cax = ax.imshow(data, interpolation='nearest') cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) plt.show() From kotaro.saito at psi.ch Tue May 8 12:14:11 2018 From: kotaro.saito at psi.ch (Saito Kotaro (PSI)) Date: Tue, 8 May 2018 18:14:11 +0200 Subject: [Matplotlib-users] fixed colorbar position for repeated plots In-Reply-To: <3297A393-4FED-479B-B661-0F2E04F313EF@iu.edu> References: <3297A393-4FED-479B-B661-0F2E04F313EF@iu.edu> Message-ID: <3CE88A58-B6CB-491D-927C-1C5653F729E6@psi.ch> Dear Randy, This might works. ------------- fig, ax = plt.subplots() # first time data = np.clip(randn(250, 250), -1, 1) img = ax.imshow(data, interpolation='nearest') cbar = fig.colorbar(img, ticks=[-1, 0, 1]) # second time, reusing colorbar axis data = 2*data img = ax.imshow(data, interpolation='nearest') cbar = fig.colorbar(img, cax=cbar.ax, ticks=[-1, 0, 1]) plt.show() ------------- If you don?t specify cax, fig.colorbar automatically rip out a part of space used by original ax for new Axes object where Colorbar object sits in. https://matplotlib.org/api/_as_gen/matplotlib.pyplot.colorbar.html That is why your code produce two colorbars. I also modified some object names in your code. There are many inappropriate colorbar examples which mix up object names such as cbar, cax and img. ax.imshow returns AxesImage object and fig.colorbar make a colorbar from this AxesImage. That is why I name it img, not cax. Then, first fig.colorbar rips out a space from the original Axes, make a new Axes for colorbar, instantiates, puts and returns a Colorbar object. https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.colorbar Colorbar object knows Axes object for itself (cbar.ax in my code). You can insert a line ?cax = cbar.ax" before second fig.colorbar and use ?cax=cax?. "2*data" in second plotting part is just to show that the second colorbar is properly produced without making new Axes. Best regards, Kotaro //================//================// Paul Scherrer Institut Kotaro SAITO ????? Laboratory for Neutron Scattering and Imaging WHGA/348 5232 Villigen PSI, Schweiz +41 56 310 3179 kotaro.saito at psi.ch https://sites.google.com/view/kotarosaito/ //================//================// > On 2018/5/ 8, at 17:28, Heiland, Randy wrote: > > I have a script that lets a user step through and plot data in files and I want to fix the position, i.e. re-use, a single colorbar. How is this done? The following script illustrates the problem: > > # adapted from https://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html > import matplotlib.pyplot as plt > import numpy as np > from numpy.random import randn > > fig, ax = plt.subplots() > data = np.clip(randn(250, 250), -1, 1) > cax = ax.imshow(data, interpolation='nearest') > cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) > > data = np.clip(randn(250, 250), -1, 1) > cax = ax.imshow(data, interpolation='nearest') > cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) > > plt.show() > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users From heiland at iu.edu Tue May 8 12:24:16 2018 From: heiland at iu.edu (Heiland, Randy) Date: Tue, 8 May 2018 16:24:16 +0000 Subject: [Matplotlib-users] fixed colorbar position for repeated plots In-Reply-To: <3CE88A58-B6CB-491D-927C-1C5653F729E6@psi.ch> References: <3297A393-4FED-479B-B661-0F2E04F313EF@iu.edu> <3CE88A58-B6CB-491D-927C-1C5653F729E6@psi.ch> Message-ID: <4E0BEAEC-DDC3-4AF9-8187-94B3B596042D@iu.edu> Thanks Kotaro! That does indeed seem to be what I needed. Randy > On May 8, 2018, at 12:14 PM, Saito Kotaro (PSI) wrote: > > Dear Randy, > > This might works. > > ------------- > fig, ax = plt.subplots() > > # first time > data = np.clip(randn(250, 250), -1, 1) > img = ax.imshow(data, interpolation='nearest') > cbar = fig.colorbar(img, ticks=[-1, 0, 1]) > > # second time, reusing colorbar axis > data = 2*data > img = ax.imshow(data, interpolation='nearest') > cbar = fig.colorbar(img, cax=cbar.ax, ticks=[-1, 0, 1]) > > plt.show() > ------------- > > If you don?t specify cax, fig.colorbar automatically rip out a part of space used by original ax for new Axes object where Colorbar object sits in. > https://matplotlib.org/api/_as_gen/matplotlib.pyplot.colorbar.html > That is why your code produce two colorbars. > > I also modified some object names in your code. > There are many inappropriate colorbar examples which mix up object names such as cbar, cax and img. > ax.imshow returns AxesImage object and fig.colorbar make a colorbar from this AxesImage. That is why I name it img, not cax. > Then, first fig.colorbar rips out a space from the original Axes, make a new Axes for colorbar, instantiates, puts and returns a Colorbar object. > https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.colorbar > Colorbar object knows Axes object for itself (cbar.ax in my code). You can insert a line ?cax = cbar.ax" before second fig.colorbar and use ?cax=cax?. > > "2*data" in second plotting part is just to show that the second colorbar is properly produced without making new Axes. > > Best regards, > > Kotaro > > //================//================// > Paul Scherrer Institut > Kotaro SAITO ????? > Laboratory for Neutron Scattering and Imaging > WHGA/348 > 5232 Villigen PSI, Schweiz > +41 56 310 3179 > kotaro.saito at psi.ch > https://sites.google.com/view/kotarosaito/ > //================//================// > >> On 2018/5/ 8, at 17:28, Heiland, Randy wrote: >> >> I have a script that lets a user step through and plot data in files and I want to fix the position, i.e. re-use, a single colorbar. How is this done? The following script illustrates the problem: >> >> # adapted from https://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html >> import matplotlib.pyplot as plt >> import numpy as np >> from numpy.random import randn >> >> fig, ax = plt.subplots() >> data = np.clip(randn(250, 250), -1, 1) >> cax = ax.imshow(data, interpolation='nearest') >> cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) >> >> data = np.clip(randn(250, 250), -1, 1) >> cax = ax.imshow(data, interpolation='nearest') >> cbar = fig.colorbar(cax, ticks=[-1, 0, 1]) >> >> plt.show() >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users > From voodoo.bender at gmail.com Tue May 8 15:13:52 2018 From: voodoo.bender at gmail.com (alberto) Date: Tue, 08 May 2018 19:13:52 +0000 Subject: [Matplotlib-users] Script two planes Message-ID: Hi I have a set of cartesian coordinates that define two plane of different atoms. Is it possible calculate distance and orthogonal projection? regards Alberto This is my data 24 test plane Pb -9.9300426676 4.1025666804 8.7420388123 Pb -4.0641923655 4.0198687706 1.6849745870 Pb -9.9866302880 4.1933336180 -1.3285956262 Pb -4.1207799859 4.1106357083 -8.3856598515 Pb -1.2684114297 4.1285931245 6.3124736259 Pb 4.5974388723 4.0458952147 -0.7445905994 Pb -1.3249990502 4.2193600622 -3.7581608126 Pb 4.5408512519 4.1366621524 -10.8152250379 Pb 7.3932198081 4.1546195686 3.8829084395 Pb 13.2590701101 4.0719216589 -3.1741557858 Pb 7.3366321877 4.2453865063 -6.1877259990 Pb 13.2024824897 4.1626885965 -13.2447902243 Mg -11.5004149207 -4.2961447648 13.2944782095 Mg -5.6345646187 -4.3788426745 6.2374139842 Mg -11.5570025411 -4.2053778271 3.2238437711 Mg -5.6911522391 -4.2880757369 -3.8332204543 Mg -2.8387836829 -4.2701183206 10.8649130231 Mg 3.0270666192 -4.3528162304 3.8078487978 Mg -2.8953713033 -4.1793513830 0.7942785847 Mg 2.9704789987 -4.2620492927 -6.2627856407 Mg 5.8228475550 -4.2440918765 8.4353478367 Mg 11.6886978570 -4.3267897862 1.3782836114 Mg 5.7662599345 -4.1533249388 -1.6352866017 Mg 11.6321102366 -4.2360228486 -8.6923508271 -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Tue May 8 15:18:54 2018 From: pmhobson at gmail.com (Paul Hobson) Date: Tue, 8 May 2018 12:18:54 -0700 Subject: [Matplotlib-users] Script two planes In-Reply-To: References: Message-ID: Alberto, It should be possible to do that with python, but I don't see a path forward where matplotlib is required. Linear algebra and interpolation available in numpy and scipy should suffice. -Paul On Tue, May 8, 2018 at 12:13 PM, alberto wrote: > Hi > I have a set of cartesian coordinates that define two plane of different > atoms. > Is it possible calculate distance and orthogonal projection? > regards > > Alberto > > This is my data > > 24 > test plane > > Pb -9.9300426676 4.1025666804 8.7420388123 > Pb -4.0641923655 4.0198687706 1.6849745870 > Pb -9.9866302880 4.1933336180 -1.3285956262 > Pb -4.1207799859 4.1106357083 -8.3856598515 > Pb -1.2684114297 4.1285931245 6.3124736259 > Pb 4.5974388723 4.0458952147 -0.7445905994 > Pb -1.3249990502 4.2193600622 -3.7581608126 > Pb 4.5408512519 4.1366621524 -10.8152250379 > Pb 7.3932198081 4.1546195686 3.8829084395 > Pb 13.2590701101 4.0719216589 -3.1741557858 > Pb 7.3366321877 4.2453865063 -6.1877259990 > Pb 13.2024824897 4.1626885965 -13.2447902243 > Mg -11.5004149207 -4.2961447648 13.2944782095 > Mg -5.6345646187 -4.3788426745 6.2374139842 > Mg -11.5570025411 -4.2053778271 3.2238437711 > Mg -5.6911522391 -4.2880757369 -3.8332204543 > Mg -2.8387836829 -4.2701183206 10.8649130231 > Mg 3.0270666192 -4.3528162304 3.8078487978 > Mg -2.8953713033 -4.1793513830 0.7942785847 > Mg 2.9704789987 -4.2620492927 -6.2627856407 > Mg 5.8228475550 -4.2440918765 8.4353478367 > Mg 11.6886978570 -4.3267897862 1.3782836114 > Mg 5.7662599345 -4.1533249388 -1.6352866017 > Mg 11.6321102366 -4.2360228486 -8.6923508271 > > _______________________________________________ > 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 voodoo.bender at gmail.com Tue May 8 17:16:35 2018 From: voodoo.bender at gmail.com (alberto) Date: Tue, 08 May 2018 21:16:35 +0000 Subject: [Matplotlib-users] Script two planes In-Reply-To: References: Message-ID: Hi Paul, I would visualize the atoms of two planes to see how much they are tilted. I'm a beginner of python, but I think that matplotlib is necessary. Alberto Il mar 8 mag 2018 09:18 PM Paul Hobson ha scritto: > Alberto, > > It should be possible to do that with python, but I don't see a path > forward where matplotlib is required. Linear algebra and interpolation > available in numpy and scipy should suffice. > -Paul > > On Tue, May 8, 2018 at 12:13 PM, alberto wrote: > >> Hi >> I have a set of cartesian coordinates that define two plane of different >> atoms. >> Is it possible calculate distance and orthogonal projection? >> regards >> >> Alberto >> >> This is my data >> >> 24 >> test plane >> >> Pb -9.9300426676 4.1025666804 8.7420388123 >> Pb -4.0641923655 4.0198687706 1.6849745870 >> Pb -9.9866302880 4.1933336180 -1.3285956262 >> Pb -4.1207799859 4.1106357083 -8.3856598515 >> Pb -1.2684114297 4.1285931245 6.3124736259 >> Pb 4.5974388723 4.0458952147 -0.7445905994 >> Pb -1.3249990502 4.2193600622 -3.7581608126 >> Pb 4.5408512519 4.1366621524 -10.8152250379 >> Pb 7.3932198081 4.1546195686 3.8829084395 >> Pb 13.2590701101 4.0719216589 -3.1741557858 >> Pb 7.3366321877 4.2453865063 -6.1877259990 >> Pb 13.2024824897 4.1626885965 -13.2447902243 >> Mg -11.5004149207 -4.2961447648 13.2944782095 >> Mg -5.6345646187 -4.3788426745 6.2374139842 >> Mg -11.5570025411 -4.2053778271 3.2238437711 >> Mg -5.6911522391 -4.2880757369 -3.8332204543 >> Mg -2.8387836829 -4.2701183206 10.8649130231 >> Mg 3.0270666192 -4.3528162304 3.8078487978 >> Mg -2.8953713033 -4.1793513830 0.7942785847 >> Mg 2.9704789987 -4.2620492927 -6.2627856407 >> Mg 5.8228475550 -4.2440918765 8.4353478367 >> Mg 11.6886978570 -4.3267897862 1.3782836114 >> Mg 5.7662599345 -4.1533249388 -1.6352866017 >> Mg 11.6321102366 -4.2360228486 -8.6923508271 >> >> _______________________________________________ >> 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 aplin.steve at gmail.com Wed May 9 09:06:06 2018 From: aplin.steve at gmail.com (Steve Aplin) Date: Wed, 9 May 2018 09:06:06 -0400 Subject: [Matplotlib-users] bar plot with datetime x axis Message-ID: Hello everyone, Having a bit of an adventure controlling the display of the x axis when plotting a pandas dataframe or series using pandas plot(), as in df.plot(kind='bar') or s.plot(kind='bar'). Here's the head of one column: 1996-01-01 180.0 1997-01-01 159.0 1998-01-01 159.0 1999-01-01 152.0 2000-01-01 121.0 Name: column A, dtype: float64 ... and here's its index: DatetimeIndex(['1996-01-01', '1997-01-01', '1998-01-01', '1999-01-01', '2000-01-01', ... ], dtype='datetime64[ns]', freq=None) I want to show a bunch of subplots, so my code looks like this: > from datetime import datetime > import matplotlib.pyplot as plt > import pandas as pd > import numpy as np > import matplotlib.dates as mdates > %matplotlib inline > > fig, axs = plt.subplots(9,2,figsize=(20,20),sharex=True) > for i,col in enumerate(df): > ax = df[col].plot(kind='bar',ax=axs[i,0]) > etc. ... which gives an x tick value for each index item (i.e. each bar), in full datetime format (YYYY-MM-DD 00:00:00), rotated 90 degrees. I don't want full datetime format, I just want the year portion. Googling the issue led me to trying this: fig.autofmt_xdate() > ... which rotates the labels, but still in full datetime format. So I tried adding > formatter = mdates.DateFormatter('%Y') > ax.xaxis.set_major_formatter(formatter) > which throws this error: ValueError: DateFormatter found a value of x=0, which is an illegal date. This usually occurs because you have not informed the axis that it is plotting dates, e.g., with ax.xaxis_date() ... which is a bit confusing, since the index is a pandas datetimeindex. Any ideas about how I could get my xaxis to not show just the year portion? Thanks in advance! Stephen E. Aplin Ottawa Canada -------------- next part -------------- An HTML attachment was scrubbed... URL: From short.chrisd at gmail.com Thu May 10 05:11:10 2018 From: short.chrisd at gmail.com (Christopher Short) Date: Thu, 10 May 2018 19:11:10 +1000 Subject: [Matplotlib-users] bar plot with datetime x axis In-Reply-To: References: Message-ID: Hi Steve, When it comes to bar plots, Pandas doesn?t pass a datetime object to matplotlib (it?s an old issue). That?s the reason for the error when attempting to format a date - it isn?t one. Easiest solution is to plot directly with matplotlib In your notation below that would be: (nothing - you don?t need to pass the returned axes back to anything) fmt = mdates.DateFormatter('%Y?) for i,col in enumerate(df): axs[i,0].bar(df.index, df[col]) axs[i,0].xaxis.set_major_formatter(fmt) Though it might be easier to read to omit I, and zip the two elements together and loop over them like this:: fig, axs = plt.subplots(9,2,figsize=(20,20),sharex=True) for col, ax in zip(df.columns, axs.flatten()): ax.bar(df.index,df[col]) ax.xaxis.set_major_formatter(fmt) That will give you horizontal, rather than vertical text as well. If you need to rotate to fit all the years in use, ax.tick_params(labelrotation=30, axis=?x) #or whatever angle you want Or use a locator to specific what you want cheers Chris > On 9 May 2018, at 11:06 pm, Steve Aplin wrote: > > Hello everyone, > > Having a bit of an adventure controlling the display of the x axis when plotting a pandas dataframe or series using pandas plot(), as in df.plot(kind='bar') or s.plot(kind='bar'). > > Here's the head of one column: > 1996-01-01 180.0 > 1997-01-01 159.0 > 1998-01-01 159.0 > 1999-01-01 152.0 > 2000-01-01 121.0 > Name: column A, dtype: float64 > > ... and here's its index: > DatetimeIndex(['1996-01-01', '1997-01-01', '1998-01-01', '1999-01-01', > '2000-01-01', ... ], > dtype='datetime64[ns]', freq=None) > I want to show a bunch of subplots, so my code looks like this: > from datetime import datetime > import matplotlib.pyplot as plt > import pandas as pd > import numpy as np > import matplotlib.dates as mdates > %matplotlib inline > > fig, axs = plt.subplots(9,2,figsize=(20,20),sharex=True) > for i,col in enumerate(df): > ax = df[col].plot(kind='bar',ax=axs[i,0]) > etc. > > ... which gives an x tick value for each index item (i.e. each bar), in full datetime format (YYYY-MM-DD 00:00:00), rotated 90 degrees. > > I don't want full datetime format, I just want the year portion. Googling the issue led me to trying this: > > fig.autofmt_xdate() > > ... which rotates the labels, but still in full datetime format. > > So I tried adding > formatter = mdates.DateFormatter('%Y') > ax.xaxis.set_major_formatter(formatter) > > which throws this error: > ValueError: DateFormatter found a value of x=0, which is an illegal date. This usually occurs because you have not informed the axis that it is plotting dates, e.g., with ax.xaxis_date() > ... which is a bit confusing, since the index is a pandas datetimeindex. > > Any ideas about how I could get my xaxis to not show just the year portion? > > Thanks in advance! > > Stephen E. Aplin > Ottawa Canada > _______________________________________________ > 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 kitecamguy at gmail.com Fri May 11 10:54:11 2018 From: kitecamguy at gmail.com (Glenn Nelson) Date: Fri, 11 May 2018 07:54:11 -0700 Subject: [Matplotlib-users] Script two planes In-Reply-To: References: Message-ID: It's been a long time since I had to do surface fitting to data (let alone display of such), so I did a quick search and found an answer for you that not only finds best-fit plane, but also displays the input points with a wireframe to represent the plane, and all of that in a rotating 3D display. The solution uses matplotlib.pytplot.plot_wireframe() and Axes3D (it imports it, but I don't see it get used). Here's the answer, from stackexchange, of course: https://math.stackexchange.com/questions/99299/best-fitting-plane-given-a-set-of-points ---- Glenn Nelson in Santa Cruz social: http://google.com/+GlennNelson see my Kite Aerial Photos at http://www.glenn-nelson.us/kap On Tue, May 8, 2018 at 2:16 PM alberto wrote: > Hi Paul, > I would visualize the atoms of two planes to see how much they are tilted. > I'm a beginner of python, but I think that matplotlib is necessary. > > Alberto > > Il mar 8 mag 2018 09:18 PM Paul Hobson ha scritto: > >> Alberto, >> >> It should be possible to do that with python, but I don't see a path >> forward where matplotlib is required. Linear algebra and interpolation >> available in numpy and scipy should suffice. >> -Paul >> >> On Tue, May 8, 2018 at 12:13 PM, alberto wrote: >> >>> Hi >>> I have a set of cartesian coordinates that define two plane of different >>> atoms. >>> Is it possible calculate distance and orthogonal projection? >>> regards >>> >>> Alberto >>> >>> This is my data >>> >>> 24 >>> test plane >>> >>> Pb -9.9300426676 4.1025666804 8.7420388123 >>> Pb -4.0641923655 4.0198687706 1.6849745870 >>> Pb -9.9866302880 4.1933336180 -1.3285956262 >>> Pb -4.1207799859 4.1106357083 -8.3856598515 >>> Pb -1.2684114297 4.1285931245 6.3124736259 >>> Pb 4.5974388723 4.0458952147 -0.7445905994 >>> Pb -1.3249990502 4.2193600622 -3.7581608126 >>> Pb 4.5408512519 4.1366621524 -10.8152250379 >>> Pb 7.3932198081 4.1546195686 3.8829084395 >>> Pb 13.2590701101 4.0719216589 -3.1741557858 >>> Pb 7.3366321877 4.2453865063 -6.1877259990 >>> Pb 13.2024824897 4.1626885965 -13.2447902243 >>> Mg -11.5004149207 -4.2961447648 13.2944782095 >>> Mg -5.6345646187 -4.3788426745 6.2374139842 >>> Mg -11.5570025411 -4.2053778271 3.2238437711 >>> Mg -5.6911522391 -4.2880757369 -3.8332204543 >>> Mg -2.8387836829 -4.2701183206 10.8649130231 >>> Mg 3.0270666192 -4.3528162304 3.8078487978 >>> Mg -2.8953713033 -4.1793513830 0.7942785847 >>> Mg 2.9704789987 -4.2620492927 -6.2627856407 >>> Mg 5.8228475550 -4.2440918765 8.4353478367 >>> Mg 11.6886978570 -4.3267897862 1.3782836114 >>> Mg 5.7662599345 -4.1533249388 -1.6352866017 >>> Mg 11.6321102366 -4.2360228486 -8.6923508271 >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >>> >> _______________________________________________ > 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 dark0s_78 at yahoo.it Sun May 13 15:07:44 2018 From: dark0s_78 at yahoo.it (dark0s) Date: Sun, 13 May 2018 19:07:44 +0000 (UTC) Subject: [Matplotlib-users] setting ticks on y axis References: <2081981241.1299496.1526238464178.ref@mail.yahoo.com> Message-ID: <2081981241.1299496.1526238464178@mail.yahoo.com> Hi all, I create boxplots with Mathplotlib but the label in the y axis are: 0, 20, 40, 60, 80, 100. How can I set labels on the y axis to be 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 and fit data according to them? Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Tue May 15 10:07:26 2018 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Tue, 15 May 2018 10:07:26 -0400 Subject: [Matplotlib-users] facecolor for legend with alpha and shadow Message-ID: Hi all, I'm wondering why using shadow=True causes shading of the legend box when framealpha is set to a number. That is, if I do: fig,ax = plt.subplots() ax.plot(x,y1,label='y1') ax.plot(x,y2,label='y2') ax.legend(framealpha=0.5,shadow=True) The face color of the legend is gray. There doesn't seem to be any reason for this, so I'm assuming it's a bug. I've been looking through the docs and haven't found anything relevant - and haven't found any way around it other than turning off the shadow. Any help would be appreciated. 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 pmhobson at gmail.com Tue May 15 13:29:37 2018 From: pmhobson at gmail.com (Paul Hobson) Date: Tue, 15 May 2018 10:29:37 -0700 Subject: [Matplotlib-users] facecolor for legend with alpha and shadow In-Reply-To: References: Message-ID: Jon, I think with the transparent legend face, you're seeing the dark shadow underneath it. This seems to be reflected when changing the alpha values.The shadow itself if is a polygon the same size of the legend, z-ordered below the legend itself, and offset slightly. Does that explain this to you? -Paul On Tue, May 15, 2018 at 7:07 AM, Slavin, Jonathan wrote: > Hi all, > > I'm wondering why using shadow=True causes shading of the legend box when > framealpha is set to a number. That is, if I do: > fig,ax = plt.subplots() > ax.plot(x,y1,label='y1') > ax.plot(x,y2,label='y2') > ax.legend(framealpha=0.5,shadow=True) > > The face color of the legend is gray. There doesn't seem to be any reason > for this, so I'm assuming it's a bug. I've been looking through the docs > and haven't found anything relevant - and haven't found any way around it > other than turning off the shadow. Any help would be appreciated. > > 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 Tue May 15 14:23:15 2018 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Tue, 15 May 2018 14:23:15 -0400 Subject: [Matplotlib-users] facecolor for legend with alpha and shadow In-Reply-To: References: Message-ID: Ah, yes that makes sense. Though I would still say that the intention of having the shadow is to have at the edges and the method of using the polygon in that way is a simple method to get it. Unfortunately the side effect of that is to cause that graying of the face of the legend when transparency is used. Seems like it would not be an easy fix. Jon On Tue, May 15, 2018 at 1:29 PM, Paul Hobson wrote: > Jon, > > I think with the transparent legend face, you're seeing the dark shadow > underneath it. This seems to be reflected when changing the alpha > values.The shadow itself if is a polygon the same size of the legend, > z-ordered below the legend itself, and offset slightly. > > Does that explain this to you? > -Paul > > On Tue, May 15, 2018 at 7:07 AM, Slavin, Jonathan > wrote: > >> Hi all, >> >> I'm wondering why using shadow=True causes shading of the legend box when >> framealpha is set to a number. That is, if I do: >> fig,ax = plt.subplots() >> ax.plot(x,y1,label='y1') >> ax.plot(x,y2,label='y2') >> ax.legend(framealpha=0.5,shadow=True) >> >> The face color of the legend is gray. There doesn't seem to be any >> reason for this, so I'm assuming it's a bug. I've been looking through the >> docs and haven't found anything relevant - and haven't found any way around >> it other than turning off the shadow. Any help would be appreciated. >> >> 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 pskeshu at gmail.com Thu May 17 10:06:51 2018 From: pskeshu at gmail.com (Kesavan Subburam) Date: Thu, 17 May 2018 19:36:51 +0530 Subject: [Matplotlib-users] Legends in single colour Message-ID: Hi everyone, I'm writing on behalf of a friend who would like to plot his scatter plot markers in different colours and shapes, but the legends should only indicate shape but no colours, essentially single colour legends. Any ideas? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jblackburne at gmail.com Thu May 17 12:36:40 2018 From: jblackburne at gmail.com (Jeff Blackburne) Date: Thu, 17 May 2018 09:36:40 -0700 Subject: [Matplotlib-users] Legends in single colour In-Reply-To: References: Message-ID: Take a look at the legend guide https://matplotlib.org/users/legend_guide.html especially proxy artists https://matplotlib.org/users/legend_guide.html#creating-artists-specifically-for-adding-to-the-legend-aka-proxy-artists Hope that helps On Thu, May 17, 2018 at 7:06 AM, Kesavan Subburam wrote: > Hi everyone, > > I'm writing on behalf of a friend who would like to plot his scatter plot > markers in different colours and shapes, but the legends should only > indicate shape but no colours, essentially single colour legends. > > Any ideas? > > > _______________________________________________ > 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 tcaswell at gmail.com Mon May 21 20:44:07 2018 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 21 May 2018 20:44:07 -0400 Subject: [Matplotlib-users] setting ticks on y axis In-Reply-To: <2081981241.1299496.1526238464178@mail.yahoo.com> References: <2081981241.1299496.1526238464178.ref@mail.yahoo.com> <2081981241.1299496.1526238464178@mail.yahoo.com> Message-ID: To adjust where the ticks are you want to set the 'locactors' on the y-axis. See https://matplotlib.org/examples/ticks_and_spines/tick-locators.html for a nice example of the many ways you can do this. What do you mean by 'and fit data according to them'? Tom On Sun, May 13, 2018 at 3:12 PM dark0s via Matplotlib-users < matplotlib-users at python.org> wrote: > Hi all, > > I create boxplots with Mathplotlib but the label in the y axis are: 0, 20, > 40, 60, 80, 100. > > How can I set labels on the y axis to be 0, 10, 20, 30, 40, 50, 60, 70, > 80, 90, 100 and fit data according to them? > > Regards. > _______________________________________________ > 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 akhilesh.phy at mnit.ac.in Thu May 24 08:13:49 2018 From: akhilesh.phy at mnit.ac.in (Akhilesh Nautiyal) Date: Thu, 24 May 2018 17:43:49 +0530 Subject: [Matplotlib-users] Help needed to fill_between two curves Message-ID: Dear Sir/Madam, I am plotting with matplotlib using two data files with different x and y ranges. I need to fill up the region between the two curves. I request you to kindly help me in this regard. I am attaching the files with this e-mail. the plot range should be between x->0.93 to 1.0 and y->0 to 0.25. Thanking you, Sincerely, akhliesh -- *********************************************************************************************** * Dr. Akhilesh Nautiyal * Assistant Professor * Department of Physics * Malaviya National Institute of Technology Jaipur * JLN Marg Jaipur-302017 * Mo: +91-9 <%2B91-9445520847>549657939 *********************************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ns_r_N_46.dat Type: application/octet-stream Size: 8770 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ns_r_N_55.dat Type: application/octet-stream Size: 10149 bytes Desc: not available URL: From vincent.adrien at gmail.com Thu May 24 12:54:37 2018 From: vincent.adrien at gmail.com (vincent.adrien at gmail.com) Date: Thu, 24 May 2018 09:54:37 -0700 Subject: [Matplotlib-users] Help needed to fill_between two curves In-Reply-To: References: Message-ID: Hi Akhliesh, For basic usage of Matpolotlib, the following tutorials may be good starting points: * https://matplotlib.org/tutorials/introductory/pyplot.html * https://matplotlib.org/tutorials/introductory/usage.html To enforce peculiar x- and y-ranges, I think that you may want to use `ax.set_xlim` and `ax.set_ylim` (or `plt.xlim` and `plt.ylim` if you prefer the interactive Pyplot interface rather than the object-oriented one). Besides, you may find the following example useful: https://matplotlib.org/gallery/lines_bars_and_markers/fill_between_demo.html to learn how to fill the aerea between 2 curves. Hopefully this will help you a bit. Best regards, Adrien On 05/24/2018 05:13 AM, Akhilesh Nautiyal wrote: > Dear Sir/Madam, > > ? ? ? ? ? ? ? ? ? ?I am plotting with matplotlib using two data files > with different x and y ranges. I need to fill up the region between the > two curves. I request you to kindly help me in this regard. I am > attaching the files with > this e-mail. the plot range should be between x->0.93 to 1.0 and y->0 to > 0.25. > > Thanking you, > Sincerely, > akhliesh > > -- > *********************************************************************************************** > * ? ?Dr. Akhilesh Nautiyal > *?? Assistant Professor > *?? Department of Physics > * ? Malaviya National Institute of Technology Jaipur > * ? JLN Marg Jaipur-302017 > * ?? Mo: +91-9 549657939 > *********************************************************************************************** > > > This body part will be downloaded on demand. > From akhilesh.phy at mnit.ac.in Fri May 25 06:44:15 2018 From: akhilesh.phy at mnit.ac.in (Akhilesh Nautiyal) Date: Fri, 25 May 2018 16:14:15 +0530 Subject: [Matplotlib-users] Help needed to fill_between two curves In-Reply-To: References: Message-ID: Dear Adrien, Thanks for the reply. I have tried all that. Actually in my case the two curves have different size of abscissa and ordinates. Suppose I make arrays like x1, y1 and x2, y2 from two data files attached in my previous mail, the arrays x1 and x2 have different size and the arrays y1 and y2 have different size. I will be grateful if you can help me how to fill the area between these curves n this particular case. With Regards, akhilesh On Thu, May 24, 2018 at 10:24 PM, vincent.adrien at gmail.com < vincent.adrien at gmail.com> wrote: > Hi Akhliesh, > > For basic usage of Matpolotlib, the following tutorials may be good > starting points: > * https://matplotlib.org/tutorials/introductory/pyplot.html > * https://matplotlib.org/tutorials/introductory/usage.html > To enforce peculiar x- and y-ranges, I think that you may want to use > `ax.set_xlim` and `ax.set_ylim` (or `plt.xlim` and `plt.ylim` if you prefer > the interactive Pyplot interface rather than the object-oriented one). > > Besides, you may find the following example useful: > https://matplotlib.org/gallery/lines_bars_and_markers/fill_ > between_demo.html > to learn how to fill the aerea between 2 curves. > > Hopefully this will help you a bit. > > Best regards, > Adrien > > On 05/24/2018 05:13 AM, Akhilesh Nautiyal wrote: > >> Dear Sir/Madam, >> >> I am plotting with matplotlib using two data files >> with different x and y ranges. I need to fill up the region between the two >> curves. I request you to kindly help me in this regard. I am attaching the >> files with >> this e-mail. the plot range should be between x->0.93 to 1.0 and y->0 to >> 0.25. >> >> Thanking you, >> Sincerely, >> akhliesh >> >> -- >> ************************************************************ >> *********************************** >> * Dr. Akhilesh Nautiyal >> * Assistant Professor >> * Department of Physics >> * Malaviya National Institute of Technology Jaipur >> * JLN Marg Jaipur-302017 >> * Mo: +91-9 549657939 >> ************************************************************ >> *********************************** >> >> >> This body part will be downloaded on demand. >> >> > -- *********************************************************************************************** * Dr. Akhilesh Nautiyal * Assistant Professor * Department of Physics * Malaviya National Institute of Technology Jaipur * JLN Marg Jaipur-302017 * Mo: +91-9 <%2B91-9445520847>549657939 *********************************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From vincent.adrien at gmail.com Fri May 25 08:40:32 2018 From: vincent.adrien at gmail.com (vincent.adrien at gmail.com) Date: Fri, 25 May 2018 05:40:32 -0700 Subject: [Matplotlib-users] Help needed to fill_between two curves In-Reply-To: References: Message-ID: <7788e64c-15eb-815b-85a6-d450901625e6@gmail.com> Hi Akhilesh, Then I guess that you need to somehow interpolate your data to share the same abscissa values, at least for the ?fill between? step. I am not very used to do this kind of things but please find attached a script that may be helpful to you (it produces to attached PNG, with Matplotlib 2.2). It uses Numpy to perform linear interpolation of your data; scipy.interpolate may also be a good source of interpolation tools if this is not good enough for you. Best, Adrien PS : I also reattach the data files, to make it easier to play with the script if somebody else wanted to propose a better solution. On 05/25/2018 03:44 AM, Akhilesh Nautiyal wrote: > Dear Adrien, > > ? ? ? ? ?Thanks for the reply. I have tried all that. Actually in my > case the two? curves have different size of abscissa and ordinates. > Suppose I make arrays like x1, y1 and x2, y2 from two data files > attached in my previous mail, the arrays x1 and x2 have different size > and the arrays y1 and y2 have different size. > I will be grateful if you can help me how to fill the area between these > curves n this particular case. > > With Regards, > akhilesh > > On Thu, May 24, 2018 at 10:24 PM, vincent.adrien at gmail.com > > wrote: > > Hi Akhliesh, > > For basic usage of Matpolotlib, the following tutorials may be good > starting points: > ? * https://matplotlib.org/tutorials/introductory/pyplot.html > > ? * https://matplotlib.org/tutorials/introductory/usage.html > > To enforce peculiar x- and y-ranges, I think that you may want to > use `ax.set_xlim` and `ax.set_ylim` (or `plt.xlim` and `plt.ylim` if > you prefer the interactive Pyplot interface rather than the > object-oriented one). > > Besides, you may find the following example useful: > https://matplotlib.org/gallery/lines_bars_and_markers/fill_between_demo.html > > to learn how to fill the aerea between 2 curves. > > Hopefully this will help you a bit. > > Best regards, > Adrien > > On 05/24/2018 05:13 AM, Akhilesh Nautiyal wrote: > > Dear Sir/Madam, > > ?? ? ? ? ? ? ? ? ? ?I am plotting with matplotlib using two > data files with different x and y ranges. I need to fill up the > region between the two curves. I request you to kindly help me > in this regard. I am attaching the files with > this e-mail. the plot range should be between x->0.93 to 1.0 and > y->0 to 0.25. > > Thanking you, > Sincerely, > akhliesh > > -- > *********************************************************************************************** > * ? ?Dr. Akhilesh Nautiyal > *?? Assistant Professor > *?? Department of Physics > * ? Malaviya National Institute of Technology Jaipur > * ? JLN Marg Jaipur-302017 > * ?? Mo: +91-9 549657939 > *********************************************************************************************** > > > This body part will be downloaded on demand. > > > > > > -- > *********************************************************************************************** > * ? ?Dr. Akhilesh Nautiyal > *?? Assistant Professor > *?? Department of Physics > * ? Malaviya National Institute of Technology Jaipur > * ? JLN Marg Jaipur-302017 > * ?? Mo: +91-9 549657939 > *********************************************************************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: example_akhilesh.py Type: text/x-python Size: 1417 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: example_akhilesh.png Type: image/png Size: 27223 bytes Desc: not available URL: -------------- next part -------------- 0.7777649027439225 0.00010299728721798685 0.778534888413173 0.00010642666300056307 0.7793008628601412 0.00010995020519029702 0.7808208874071819 0.00011728764856451117 0.7815749915663855 0.00012110554036633412 0.782325192626475 0.00012502557970165977 0.7838139909765232 0.0001331803481720669 0.7845526404533767 0.0001374192609951405 0.7852874912095886 0.00014176868856181454 0.7867458984466191 0.00015080771781858767 0.7896182366974104 0.00017030820338468077 0.79032719887478 0.00017549279705574011 0.7910325604471398 0.00018080577507010817 0.7924325768110586 0.00019182625785632722 0.7951904362852443 0.0002155122050792516 0.7958712489557411 0.0002217905871218254 0.7965486458710345 0.0002282166799403028 0.797893281148427 0.0002415220746601718 0.8005425279823185 0.00027001740861596496 0.8011966264537461 0.0002775490338820485 0.8018474817772919 0.0002852490601231336 0.8031395458564915 0.0003011650405675561 0.8056856581797209 0.0003351368484593093 0.8063143831517847 0.00034409167834795586 0.8069400262773251 0.00035323684296021464 0.8081821444723657 0.00037210948195553426 0.810630242063823 0.0004122640658221719 0.8112348468417727 0.0004228215175729612 0.8118365206270748 0.0004335923361829363 0.8130311477188241 0.0004557858807428975 0.8153860191961073 0.0005028640231440689 0.8159676763076312 0.000515211729054082 0.8165465436210292 0.0005277967650512714 0.8176959767427735 0.0005536910457116875 0.8199621045274258 0.0006084625803755528 0.8205688783677255 0.0006240124493479633 0.8211725303705313 0.0006398706023735845 0.8223705498355804 0.0006725277346842233 0.8247300076332486 0.0007417177098466896 0.8253123650630758 0.0007598461703585147 0.8258917581154859 0.0007783151168970895 0.8270417266320703 0.0008162907224618817 0.8293069131304805 0.0008965068685443686 0.8298660765176573 0.0009174732507137566 0.8304224224909986 0.0009388127495713375 0.8315267327469041 0.0009826274686283668 0.8337023120786754 0.0010749144041535892 0.8379250706331431 0.0012790335966513188 0.8384411955539658 0.0013064602630736537 0.8389547687849435 0.0013343252676645786 0.8399743219030351 0.001391386395008962 0.8419834798329024 0.0015109452775087402 0.8424796172072151 0.0015419908623625356 0.8429733231262315 0.0015735067087677024 0.8439534984288661 0.0016379649081388812 0.8458853012488958 0.0017726965345528317 0.8463623861688996 0.0018076135069004969 0.8468371523316116 0.0018430317707915757 0.8477797826275683 0.001915387354940656 0.8496378088490358 0.002066279900828453 0.853247827397222 0.0023936133892203454 0.853660188807904 0.002434103040962055 0.8540707067298408 0.00247508025252723 0.8548862511264194 0.00255850848788272 0.8564956434112792 0.0027313369244032384 0.8568935266878274 0.002775803916000391 0.8572896427444043 0.002820780159827517 0.8580766100714385 0.002912270814487526 0.8596297401249036 0.0031014763044270857 0.8600137406445666 0.0031500889899996466 0.8603960460507769 0.003199231108081076 0.8611556064065393 0.0032991132487937154 0.862654766161712 0.003505334907692507 0.8655751205219364 0.003944110761875947 0.865933015048348 0.004001468145286187 0.8662893473639566 0.004059390190518583 0.8669973566834337 0.004176936064340147 0.868394970459068 0.0044188878343903336 0.8711182679362534 0.004930628654503342 0.8714520802172682 0.0049972382841679186 0.8717844498434613 0.005064440177652245 0.8724448893738104 0.005200626544731414 0.8737487647669581 0.005480168291477531 0.8762900265374215 0.006068209689628644 0.8765954820701777 0.006142950330626754 0.8768996546832621 0.006218278786798908 0.8775041752538003 0.006370702601249869 0.8786980845073213 0.006682640290368173 0.881026680304881 0.007335029313740957 0.8813123137805693 0.007419262167315135 0.8815967567596672 0.0075040930440074495 0.882162093182373 0.0076755503272223705 0.8832787198255495 0.008025655497444275 0.885456978386095 0.008754670165084683 0.8857242063939582 0.008848498805261229 0.8859903282265861 0.008942927730228402 0.8865192734360914 0.009133585930948158 0.8875641089914412 0.009522098529006734 0.889602649932043 0.010327841897363658 0.8934835837341364 0.012053278292409151 0.893737582465146 0.012175701967128996 0.8939904542701391 0.012298810496481315 0.894492838705263 0.01254707683512872 0.8954843204353634 0.01305176764638926 0.8974153074682911 0.014093440636015432 0.8976519080277009 0.014226644888024158 0.8978874647273882 0.01436050883523896 0.8983554663444109 0.01463020836149866 0.8992791595525931 0.015177440008979318 0.9010783810870651 0.01630277666922027 0.9012988600848018 0.016446296189366057 0.9015183714388144 0.016590442082491132 0.9019545094066513 0.01688060365459143 0.9028153724026475 0.01746833912249649 0.9044924354929038 0.018672903306015592 0.9076755244158464 0.021193638460084555 0.9078544210433944 0.021345078660284983 0.9080325919936781 0.021496989484307106 0.908386769435657 0.02180221313806189 0.9090865536858938 0.022418198701231455 0.9104525252982896 0.02367175469489287 0.9130553812836999 0.026260518535110022 0.9132125476639876 0.02642574101424769 0.9133690822260596 0.026591349991580596 0.9136802667566558 0.026923716361370205 0.9142951727893507 0.02759296487239111 0.9154957254433618 0.02894889739566586 0.9177843786930225 0.031725427880303886 0.9179341652186026 0.031916386383745034 0.9180833053155302 0.032107692011051965 0.9183796581960538 0.03249133001124663 0.9189647377112328 0.033262610596720275 0.9201050440010922 0.0348203713317557 0.9222712803827299 0.03799016585474537 0.9224017988562213 0.03819042443107683 0.9225317600187741 0.03839091398844474 0.9227900206840374 0.038792571795979974 0.923299966604774 0.03959850278306335 0.9242941165842453 0.041220036797912786 0.9261837711360066 0.04449558243660411 0.9262955995433069 0.04469774436357472 0.926406964481816 0.04490002274134918 0.926628312302201 0.04530491639762481 0.9270655376225101 0.046115964712408995 0.9279185622190063 0.04774242122084563 0.9295424246051323 0.05100744681724717 0.9324876591698652 0.0575458613542144 0.932567891629777 0.057735965458793344 0.9326478215820904 0.05792601772740559 0.9328067789940242 0.05830595916185916 0.9331211187526971 0.05906513702385775 0.9337357727394826 0.060580260498656585 0.9349111061036649 0.06359441776369323 0.9370618274929104 0.06953527666513784 0.9371303441976264 0.06973411667655945 0.9371985881475118 0.06993277658688651 0.9373342626315764 0.07032954971048683 0.9376023915592556 0.07112086515693776 0.9381260335169028 0.07269423181247296 0.9391248946939715 0.07580135389999199 0.9409441472797399 0.08183939446813575 0.9437953928798332 0.09239458772604517 0.9460340054277968 0.10174499263964984 0.9479805671855708 0.11074547984309428 0.9494440757999822 0.11810845541086937 0.9507309348798171 0.12504784758546283 0.9517563046144303 0.13091432115797763 0.9525445927357128 0.13564157238236288 0.9532534796389293 0.14006297235390838 0.9538045838576086 0.14361682931868408 0.9543046317647983 0.14693320750152303 0.9547157983871705 0.14972771242261054 0.9550411628681701 0.15198352970102763 0.955341707882793 0.15410301471803065 0.9555816083965647 0.15581995999699597 0.9557849525868717 0.15729305104246002 0.9559756214216941 0.15868935457906688 0.9561298517236254 0.15982959630331486 0.9562752262636938 0.16091329875654214 0.9563992714615974 0.16184492306218917 0.9565007796512103 0.16261207051489773 0.9565976251761754 0.16334802468759338 0.9566773324552645 0.16395672360767785 0.9567468090776797 0.16448950400191703 0.9568137842759892 0.16500506067225904 0.9568693996312279 0.1654346401325758 0.9569231734537543 0.16585126703796688 0.9569680344863356 0.1661997998655588 0.957007615954876 0.16650804251632434 0.9570462157072535 0.16680929891427695 0.9570786503693186 0.16706294351760667 0.957110349168441 0.1673112797035159 0.9571383849633606 0.16753128736241749 0.9571620956733499 0.1677176248229922 0.9571854383087164 0.1679013121639535 0.9572052469505404 0.1680573789075401 0.9572230025692644 0.16819741816949874 0.9572405958954725 0.16833631533776527 0.957255603470907 0.16845490694844337 0.9572558540102493 0.168456887588968 0.9572561041781625 0.16845886532100193 0.9572566034023409 0.16846281207996663 0.9572575974225008 0.1684706709194907 0.9572595678960633 0.16848625101237727 0.9572634397264728 0.16851686973758218 0.9572636787008129 0.16851875978305417 0.9572639173241839 0.16852064707806214 0.9572643935204885 0.168524413435779 0.9572653417285698 0.16853191335513282 0.9572672215433351 0.16854678306645896 0.9572674549756102 0.1685486296722525 0.9572676880666519 0.16855047360285302 0.9572681532274255 0.16855415345696448 0.9572690794804001 0.1685614812657372 0.9572693101994824 0.16856330659896 0.9572695405820808 0.168565129293729 0.9572700003401783 0.16856876678610094 0.9572702297168503 0.168570581592779 0.9572704587593843 0.1685723937791533 0.957270687468364 0.1685742033497388 0.9572709158443715 0.16857601030904143 -------------- next part -------------- 0.7777757357684436 0.000016335999618040326 0.7785460686329915 0.000016988019701830734 0.7793123992698467 0.000017662262919540527 0.7808331638548643 0.000019079886255473243 0.781587652203127 0.000019824530940487907 0.782338247128761 0.000020593928127496754 0.7838278629373382 0.000022209647249467747 0.7845669363596988 0.000023057334768970906 0.7853022214429008 0.00002393250617856618 0.786761529198422 0.000025768174818545244 0.7896358010573459 0.000029801677639463424 0.7903452753355482 0.00003089000770344715 0.7910511608632793 0.000032011917940761335 0.7924522614607283 0.00003435978617943431 0.7931475239192247 0.000035587432680385596 0.7938392924088281 0.000036852036514820314 0.7952124400672305 0.00003949564835180881 0.7958938650408303 0.00004087645808122218 0.7965718876589778 0.00004229782873596111 0.7979178153319364 0.00004526601456272042 0.8005698164959005 0.000051731311280843844 0.8012246400415597 0.00005346365468535062 0.8018762354402714 0.000055244462373369554 0.8031698254859825 0.00005895570233515126 0.8038118615435857 0.000060888287685843135 0.8044507522787983 0.00006287364353503569 0.8057191787297855 0.00006700713722534954 0.8063487545019494 0.00006915754778114847 0.8069752650677027 0.00007136527429801587 0.8082191688902329 0.00007595738581555366 0.8106710465240436 0.0000858820588726138 0.8112766410197801 0.00008852470793867714 0.8118793228208372 0.0000912344849545665 0.8130760216681219 0.00009686061400529349 0.8154352653576341 0.00010897634665808654 0.8160180643756256 0.00011219308860916741 0.8165980935498055 0.00011548772814828982 0.8177499110793256 0.00012231636591281808 0.8200210561634186 0.0001369715549512006 0.820629248228901 0.00014118230704598424 0.8212343438500033 0.00014549852535503474 0.8224353277575863 0.00015445517823505287 0.8248010303919069 0.00017372115485053607 0.8253850163257151 0.0001788313042633412 0.8259660652995626 0.00018406305349991868 0.8271194288995094 0.00019489977487906066 0.8293917453592554 0.00021812608618046827 0.8299527634320777 0.00022426888062946476 0.8305109934440166 0.0002305505864497117 0.8316191607711516 0.00024353971766118525 0.8338028166593698 0.0002712846796845614 0.834342023344378 0.00027860246626665026 0.8348785810931848 0.0002860775568577737 0.8359438166066415 0.0003015091425345411 0.8380432277235448 0.000334365193982153 0.8385617039418687 0.0003430085673240129 0.8390776613173992 0.0003518285999155786 0.8401020820559864 0.0003700085771300069 0.8421213779339637 0.00040859840982242354 0.8426201347816739 0.0004187251947575634 0.8431164945307418 0.00042904881893442604 0.8441020812644973 0.0004502968870074472 0.8460451267714436 0.0004952689675215598 0.8465251107788375 0.0005070430560917572 0.847002811709291 0.0005190348341418963 0.8479514191847253 0.0005436820468382854 0.8498218343813563 0.0005957056173781013 0.8502839323490993 0.000609295683050785 0.850743854115922 0.0006231247905634578 0.8516572204804961 0.0006515109180193241 0.853458398894626 0.0007112705744783362 0.8538740144300152 0.0007258083171668824 0.8542878193468926 0.0007405732106755942 0.8551100366605946 0.0007707933180875404 0.8567331725542408 0.0008340569538302366 0.8571345750015424 0.0008504740289372028 0.857534243662208 0.0008671360124817237 0.8583284167274731 0.0009012035861597845 0.8598963618348788 0.0009723752747427367 0.8602841504683026 0.000990813733443152 0.8606702778105391 0.0010095148301262071 0.8614375836474831 0.0010477137646421968 0.8629526416440031 0.0011273602168183135 0.8659064260389627 0.0013001371241911281 0.8662686526515834 0.0013230406446369347 0.8666293511272967 0.0013462416406702954 0.8673461949564625 0.001393544578696149 0.8687618861341855 0.0014918134721966171 0.8691121040462103 0.0015171560758894705 0.8694608550144425 0.0015428130001380767 0.8701539857284838 0.0015950780790112845 0.8715229667237582 0.0017034705303133832 0.8718616539022199 0.001731385129212897 0.8721989320651564 0.0017596303428201725 0.872869289388101 0.0018171205716894802 0.8741934017122753 0.0019361553276167284 0.8767767284384262 0.0021908730157051953 0.8770874834825313 0.002223650744631109 0.8773969869067121 0.0022567754964680775 0.8780122626685526 0.0023240728251292713 0.8792280541560329 0.0024629053433908948 0.8816018807627982 0.0027578828797205105 0.881893303585002 0.002796408517797617 0.8821835656615524 0.0028353066144683934 0.8827606290794539 0.0029142260342516816 0.883901061649588 0.0030765978664119226 0.8861283122948463 0.0034197808366238413 0.8864017911977455 0.0034644329563165875 0.8866741916746625 0.0035094790845266914 0.8872157768662097 0.003600758173207383 0.888286219201403 0.0037880963572158206 0.8903772481878314 0.004182139393438838 0.890634042820388 0.004233230563359991 0.8908898338596767 0.004284732922613559 0.8913984229336194 0.0043889748724264014 0.8924037520775011 0.00460243230399202 0.894367977825869 0.005049422465630639 0.8946296404126755 0.005112108615386793 0.8948902028048245 0.00517529336468499 0.8954080477247358 0.005303161786974952 0.8964307614266785 0.005564914720051748 0.8984254057611067 0.006112625808590513 0.8986700708942732 0.006183369255184661 0.8989137152654234 0.006254620725147061 0.8993979605857139 0.006398649162004613 0.9003544080844659 0.006692816528908387 0.9022201529333629 0.007305639131185316 0.902449037856334 0.007384539771060294 0.9026769744565379 0.007463951087191793 0.9031300199266494 0.007624305498470034 0.904024919291604 0.00795113825088416 0.9057708871758516 0.008629252625431513 0.9090946885748368 0.010082567848302334 0.9092818968350236 0.010171296370266156 0.909468389674582 0.01026045742829747 0.9098392409157202 0.010440074434407087 0.910572487625927 0.010804468035184906 0.9120058022329365 0.011553719919577335 0.9121819111458714 0.011649278664635578 0.9123573503431167 0.011745257161689237 0.9127062305533843 0.011938469658587933 0.9133960742678678 0.012329889541214924 0.9147446926963559 0.013132479438538784 0.9149104084345259 0.013234633722100394 0.9150754968743736 0.01333719103496383 0.9154038020449806 0.013543510073739506 0.9160529962092239 0.01396093233421555 0.9173222756619905 0.014814634980766619 0.9197487000539764 0.016595080576164937 0.9199078216497182 0.016719086650811815 0.9200662962069338 0.01684351501056214 0.920381315448707 0.01709363075757815 0.9210037124071946 0.017598842849732645 0.9222185531306712 0.018628735075161162 0.9245331580353815 0.020762608322231358 0.9246729073579825 0.020899100737174024 0.9248120935072788 0.021035947396488817 0.925088785983442 0.021310694330496982 0.9256355189148437 0.021864338445972735 0.9267029057952103 0.022987708570439806 0.9287374562553337 0.02529455153989008 0.9288580986972698 0.025438543447554425 0.9289782681435703 0.02558280398551729 0.9292171959964906 0.025872121778534592 0.9296894626902912 0.026453879922317427 0.9306120740554962 0.02762937090087369 0.9323729698467762 0.030024121013620196 0.9324794213463623 0.030175567424303856 0.9325854593890054 0.030327208824187064 0.932796302018321 0.03063106743802409 0.9332131014405624 0.03124102396670066 0.9340275346816447 0.03246938465043457 0.9355826648641054 0.034955860979698064 0.9356703990526622 0.035101898994931185 0.9357578185052208 0.03524804436287889 0.9359317180933154 0.035540650091267556 0.9362757939646188 0.03612707226813422 0.9369493201423809 0.03730436878386791 0.9382399482683448 0.03967370114681727 0.9406111695142683 0.044447781311943824 0.9406869183717939 0.04460992358860743 0.9407623786398382 0.044772069818133337 0.9409124382284408 0.04509636675172041 0.9412091470702815 0.04574492728591572 0.9417891867272469 0.047041512097491724 0.9428977931198007 0.0496294257982584 0.9449244060035842 0.054761179348981316 0.9449799657715435 0.054909636358041705 0.9450353328361704 0.05505800869503079 0.9451454918249732 0.05535449512219284 0.9453635298592401 0.0559464057395587 0.9457906486091332 0.05712574947694491 0.9466103175717037 0.05946478501438708 0.9481208751997605 0.06405166683118148 0.9506487222466087 0.07261513919353746 0.9528604472226588 0.08115013837996406 0.9545320215486064 0.08834403082998278 0.9560082084967046 0.0952981947307872 0.957188817787148 0.10130912344386453 0.9580991510324804 0.10624099586006401 0.958919828360663 0.11092528953331189 0.9595591931432632 0.11474075575411312 0.9601403606245743 0.11834185628941693 0.960618973763021 0.12140681999162109 0.960998190896792 0.12390140811335712 0.9613488606653192 0.12626193172043604 0.9616290351599471 0.1281860319062331 0.961866700414415 0.12984536459113197 0.9620897050108227 0.13142547299091267 0.9622702009182336 0.13272107263982133 0.9624404228672779 0.13395682134291104 0.9625857390786909 0.1350225821969733 0.9627047012167975 0.13590256717520716 0.9628182389302857 0.13674879595614559 0.9629117138019544 0.13745020195929147 0.9629932125472003 0.13806524271487838 0.9630717961338462 0.13866139315041248 0.963137065220827 0.13915887247966413 0.9632001854501651 0.1396420005904689 0.9632528530448143 0.1400466565738013 0.9632993293628924 0.14040490754884546 0.9633446592983838 0.14075537731656376 0.9633827540554143 0.14105071699424204 0.963419988814567 0.14134010566452201 0.9634529243799075 0.14159667303181622 0.9634807815575828 0.1418141148997867 0.9635082086082201 0.1420285898465467 0.9635314851019025 0.14221091273427003 0.9635523505619081 0.14237458838597214 0.963573026617049 0.1425370008175463 0.963590664875343 0.14267572644277013 0.9635909593398826 0.14267804379037294 0.963591253368138 0.14268035774952706 0.9635918401188927 0.14268497552606682 0.9635930084189657 0.14269417067645157 0.9635953243847419 0.14271240067162122 0.963599875128808 0.1427482297254643 0.9636001560086451 0.1427504415099612 0.9636004364762094 0.1427526500889776 0.9636009961774187 0.1427570576526824 0.9636021106643713 0.14276583455696004 0.9636043201368695 0.14278323669725476 0.9636045945065363 0.14278539785167638 0.963604868475357 0.1427875558878074 0.9636054152132648 0.14279186262661805 0.9636065039097086 0.14280043891978275 0.9636067750921755 0.1428025752773033 0.9636070458793708 0.14280470855909896 0.9636075862707069 0.14280896591659878 0.9636078558762242 0.14281109000281844 0.9636081250892232 0.14281321103434413 0.9636083939103889 0.14281532901640764 0.9636086623404047 0.1428174439542304 From bala.biophysics at gmail.com Mon May 28 08:16:51 2018 From: bala.biophysics at gmail.com (Bala subramanian) Date: Mon, 28 May 2018 14:16:51 +0200 Subject: [Matplotlib-users] Creating a smooth surface in 3D Message-ID: Dear mpl friends, My objective is to create a molecular surface using matplotlib. I used the snippet pasted below to create a series of spheres (attached png), drawn using the atom attributes (their positions and radius). From here, I would like to create a smooth surface which can depict the shape of the molecule surface (curves,cavities etc). Based on examples in net, I get a mixed feeling that either triangulation or making 3D grids are some directions to proceed. If anyone has some suggestions or better protocols for such task with some example data, it would be of great help to me. fig = plt.figure(figsize=(6,6),dpi=140) ax1 = fig.add_subplot(111, projection='3d') # Define spherical coordinates u, v = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j] S = np.cos(u)*np.sin(v) C = np.sin(u)*np.sin(v) T = np.cos(v) for P,R in zip(positions,radii): ax1.plot_wireframe(R*S+P[0],R*C+P[1],R*T+P[2],color='r',alpha=0.4) Thanks in advance, Bala -- C. Balasubramanian -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.png Type: image/png Size: 474060 bytes Desc: not available URL: From ben.v.root at gmail.com Mon May 28 09:19:02 2018 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 28 May 2018 09:19:02 -0400 Subject: [Matplotlib-users] Creating a smooth surface in 3D In-Reply-To: References: Message-ID: mplot3d is good for real simple 3d scenes, but it falls apart when you start composing things like this. You might want to consider using something like glumpy or mayavi for better results. There are some discussions in the past on the problems inherent in creating spheres in mplot3d. There are some interesting solutions, but they get fairly complex pretty quickly. Cheers! Ben Root On Mon, May 28, 2018 at 8:16 AM, Bala subramanian wrote: > Dear mpl friends, > > My objective is to create a molecular surface using matplotlib. I used the > snippet pasted below to create a series of spheres (attached png), drawn > using the atom attributes (their positions and radius). From here, I would > like to create a smooth surface which can depict the shape of the molecule > surface (curves,cavities etc). Based on examples in net, I get a mixed > feeling that either triangulation or making 3D grids are some directions to > proceed. If anyone has some suggestions or better protocols for such task > with some example data, it would be of great help to me. > > fig = plt.figure(figsize=(6,6),dpi=140) > > ax1 = fig.add_subplot(111, projection='3d') > > # Define spherical coordinates > > u, v = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j] > > S = np.cos(u)*np.sin(v) > > C = np.sin(u)*np.sin(v) > > T = np.cos(v) > > for P,R in zip(positions,radii): > > ax1.plot_wireframe(R*S+P[0],R*C+P[1],R*T+P[2],color='r',alph > a=0.4) > > Thanks in advance, > > Bala > > > -- > C. Balasubramanian > > _______________________________________________ > 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 akhilesh.phy at mnit.ac.in Tue May 29 01:50:29 2018 From: akhilesh.phy at mnit.ac.in (Akhilesh Nautiyal) Date: Tue, 29 May 2018 11:20:29 +0530 Subject: [Matplotlib-users] Help needed to fill_between two curves In-Reply-To: <7788e64c-15eb-815b-85a6-d450901625e6@gmail.com> References: <7788e64c-15eb-815b-85a6-d450901625e6@gmail.com> Message-ID: Dear Adrien, Thanks a lot for your kind help. With this I am getting an extra filled region as the abscissa of N_46 is getting extended. I will try to play around with this to find some solution. Regards, akhilesh On Fri, May 25, 2018 at 6:10 PM, vincent.adrien at gmail.com < vincent.adrien at gmail.com> wrote: > Hi Akhilesh, > > Then I guess that you need to somehow interpolate your data to share the > same abscissa values, at least for the ?fill between? step. I am not very > used to do this kind of things but please find attached a script that may > be helpful to you (it produces to attached PNG, with Matplotlib 2.2). It > uses Numpy to perform linear interpolation of your data; scipy.interpolate > may also be a good source of interpolation tools if this is not good enough > for you. > > Best, > Adrien > > PS : I also reattach the data files, to make it easier to play with the > script if somebody else wanted to propose a better solution. > > On 05/25/2018 03:44 AM, Akhilesh Nautiyal wrote: > >> Dear Adrien, >> >> Thanks for the reply. I have tried all that. Actually in my >> case the two curves have different size of abscissa and ordinates. >> Suppose I make arrays like x1, y1 and x2, y2 from two data files >> attached in my previous mail, the arrays x1 and x2 have different size >> and the arrays y1 and y2 have different size. >> I will be grateful if you can help me how to fill the area between these >> curves n this particular case. >> >> With Regards, >> akhilesh >> >> On Thu, May 24, 2018 at 10:24 PM, vincent.adrien at gmail.com > vincent.adrien at gmail.com> > vincent.adrien at gmail.com>> wrote: >> >> Hi Akhliesh, >> >> For basic usage of Matpolotlib, the following tutorials may be good >> starting points: >> * https://matplotlib.org/tutorials/introductory/pyplot.html >> >> * https://matplotlib.org/tutorials/introductory/usage.html >> >> To enforce peculiar x- and y-ranges, I think that you may want to >> use `ax.set_xlim` and `ax.set_ylim` (or `plt.xlim` and `plt.ylim` if >> you prefer the interactive Pyplot interface rather than the >> object-oriented one). >> >> Besides, you may find the following example useful: >> https://matplotlib.org/gallery/lines_bars_and_markers/fill_ >> between_demo.html >> > between_demo.html> >> to learn how to fill the aerea between 2 curves. >> >> Hopefully this will help you a bit. >> >> Best regards, >> Adrien >> >> On 05/24/2018 05:13 AM, Akhilesh Nautiyal wrote: >> >> Dear Sir/Madam, >> >> I am plotting with matplotlib using two >> data files with different x and y ranges. I need to fill up the >> region between the two curves. I request you to kindly help me >> in this regard. I am attaching the files with >> this e-mail. the plot range should be between x->0.93 to 1.0 and >> y->0 to 0.25. >> >> Thanking you, >> Sincerely, >> akhliesh >> >> -- ***************************** >> ****************************************************************** >> * Dr. Akhilesh Nautiyal >> * Assistant Professor >> * Department of Physics >> * Malaviya National Institute of Technology Jaipur >> * JLN Marg Jaipur-302017 >> * Mo: +91-9 549657939 >> ************************************************************ >> *********************************** >> >> >> This body part will be downloaded on demand. >> >> >> >> >> >> -- >> ************************************************************ >> *********************************** >> * Dr. Akhilesh Nautiyal >> * Assistant Professor >> * Department of Physics >> * Malaviya National Institute of Technology Jaipur >> * JLN Marg Jaipur-302017 >> * Mo: +91-9 549657939 >> ************************************************************ >> *********************************** >> > > -- *********************************************************************************************** * Dr. Akhilesh Nautiyal * Assistant Professor * Department of Physics * Malaviya National Institute of Technology Jaipur * JLN Marg Jaipur-302017 * Mo: +91-9 <%2B91-9445520847>549657939 *********************************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: From flyamer at gmail.com Tue May 29 14:20:56 2018 From: flyamer at gmail.com (Ilya Flyamer) Date: Tue, 29 May 2018 19:20:56 +0100 Subject: [Matplotlib-users] annotation arrow shrink Message-ID: Hi all, I am trying to figure out how shrinkA works for arrows in annotations, and it seems very confusing from experimenting with it - is there an explanation somewhere online? I simply wanted to ensure that the arrow starts at the edge of the bounding box, but it's not so easy, it seems... Is this not the right way to do this, maybe? Thanks! Cheers, Ilya -------------- next part -------------- An HTML attachment was scrubbed... URL: From vincent.adrien at gmail.com Tue May 29 18:21:48 2018 From: vincent.adrien at gmail.com (vincent.adrien at gmail.com) Date: Tue, 29 May 2018 15:21:48 -0700 Subject: [Matplotlib-users] annotation arrow shrink In-Reply-To: References: Message-ID: Hi Ilya, Using a null-value for `shrinkA` or `shrinkB` does not achieve what you want? FWIW, I think that the method used under the hood by `FancyArrowPatch` is located [here](https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/patches.py#L2706), while the percentage-to-points machinery in `Axes.annotate` (when *arrowstyle* is `None` and using the *shrink* parameter) seems to start [there](https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/text.py#L2128). Attached is a small snippet demonstrating both the percentage-based and the point-based shrinking possibilities, in case this might help. Best, Adrien On 05/29/2018 11:20 AM, Ilya Flyamer wrote: > Hi all, > > I am trying to figure out how shrinkA works for arrows in annotations, > and it seems very confusing from experimenting with it - is there an > explanation somewhere online? > I simply wanted to ensure that the arrow starts at the edge of the > bounding box, but it's not so easy, it seems... Is this not the right > way to do this, maybe? > > Thanks! > > Cheers, > Ilya > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- A non-text attachment was scrubbed... Name: shrink_playground.py Type: text/x-python Size: 1061 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: shrink_playground.png Type: image/png Size: 15503 bytes Desc: not available URL: From vincent.adrien at gmail.com Tue May 29 21:53:29 2018 From: vincent.adrien at gmail.com (vincent.adrien at gmail.com) Date: Tue, 29 May 2018 18:53:29 -0700 Subject: [Matplotlib-users] Help needed to fill_between two curves In-Reply-To: References: <7788e64c-15eb-815b-85a6-d450901625e6@gmail.com> Message-ID: <5d8df09b-7112-6b77-3b30-b686d2d3da73@gmail.com> Akhilesh, I am not totally sure that I understand what is your remaining issue. To me, it seems that it is just a matter of building the ?correct? common abscissa vector to pass to ``fill_between``. See for example the attached snippet for another kind of abscissa vector that would be possible and maybe better suited to what you want. Regards, Adrien On 05/28/2018 10:50 PM, Akhilesh Nautiyal wrote: > Dear Adrien, > > ? ?Thanks a lot for your kind help. With this I am getting an extra > filled region as the abscissa of N_46 is getting extended. I will try to > play around with this to find some solution. > > Regards, > akhilesh > > On Fri, May 25, 2018 at 6:10 PM, vincent.adrien at gmail.com > > wrote: > > Hi Akhilesh, > > Then I guess that you need to somehow interpolate your data to share > the same abscissa values, at least for the ?fill between? step. I am > not very used to do this kind of things but please find attached a > script that may be helpful to you (it produces to attached PNG, with > Matplotlib 2.2). It uses Numpy to perform linear interpolation of > your data; scipy.interpolate may also be a good source of > interpolation tools if this is not good enough for you. > > Best, > Adrien > > PS : I also reattach the data files, to make it easier to play with > the script if somebody else wanted to propose a better solution. > > On 05/25/2018 03:44 AM, Akhilesh Nautiyal wrote: > > Dear Adrien, > > ?? ? ? ? ?Thanks for the reply. I have tried all that. Actually > in my case the two? curves have different size of abscissa and > ordinates.? Suppose I make arrays like x1, y1 and x2, y2 from > two data files > attached in my previous mail, the arrays x1 and x2 have > different size and the arrays y1 and y2 have different size. > I will be grateful if you can help me how to fill the area > between these curves n this particular case. > > With Regards, > akhilesh > > On Thu, May 24, 2018 at 10:24 PM, vincent.adrien at gmail.com > > > > >> wrote: > > ? ? Hi Akhliesh, > > ? ? For basic usage of Matpolotlib, the following tutorials may > be good > ? ? starting points: > ? ? ?? * > https://matplotlib.org/tutorials/introductory/pyplot.html > > ? ? > > ? ? ?? * > https://matplotlib.org/tutorials/introductory/usage.html > > ? ? > > ? ? To enforce peculiar x- and y-ranges, I think that you may > want to > ? ? use `ax.set_xlim` and `ax.set_ylim` (or `plt.xlim` and > `plt.ylim` if > ? ? you prefer the interactive Pyplot interface rather than the > ? ? object-oriented one). > > ? ? Besides, you may find the following example useful: > https://matplotlib.org/gallery/lines_bars_and_markers/fill_between_demo.html > > > > > ? ? to learn how to fill the aerea between 2 curves. > > ? ? Hopefully this will help you a bit. > > ? ? Best regards, > ? ? Adrien > > ? ? On 05/24/2018 05:13 AM, Akhilesh Nautiyal wrote: > > ? ? ? ? Dear Sir/Madam, > > ? ? ? ? ??? ? ? ? ? ? ? ? ? ?I am plotting with matplotlib > using two > ? ? ? ? data files with different x and y ranges. I need to > fill up the > ? ? ? ? region between the two curves. I request you to kindly > help me > ? ? ? ? in this regard. I am attaching the files with > ? ? ? ? this e-mail. the plot range should be between x->0.93 > to 1.0 and > ? ? ? ? y->0 to 0.25. > > ? ? ? ? Thanking you, > ? ? ? ? Sincerely, > ? ? ? ? akhliesh > > ? ? ? ? -- > ?*********************************************************************************************** > ? ? ? ? * ? ?Dr. Akhilesh Nautiyal > ? ? ? ? *?? Assistant Professor > ? ? ? ? *?? Department of Physics > ? ? ? ? * ? Malaviya National Institute of Technology Jaipur > ? ? ? ? * ? JLN Marg Jaipur-302017 > ? ? ? ? * ?? Mo: +91-9 549657939 > > *********************************************************************************************** > > > ? ? ? ? This body part will be downloaded on demand. > > > > > > -- > *********************************************************************************************** > * ? ?Dr. Akhilesh Nautiyal > *?? Assistant Professor > *?? Department of Physics > * ? Malaviya National Institute of Technology Jaipur > * ? JLN Marg Jaipur-302017 > * ?? Mo: +91-9 549657939 > *********************************************************************************************** > > > > > > -- > *********************************************************************************************** > * ? ?Dr. Akhilesh Nautiyal > *?? Assistant Professor > *?? Department of Physics > * ? Malaviya National Institute of Technology Jaipur > * ? JLN Marg Jaipur-302017 > * ?? Mo: +91-9 549657939 > *********************************************************************************************** -------------- next part -------------- A non-text attachment was scrubbed... Name: example_akhilesh_v2.py Type: text/x-python Size: 1652 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: example_akhilesh_v2.png Type: image/png Size: 26833 bytes Desc: not available URL: From flyamer at gmail.com Wed May 30 09:31:22 2018 From: flyamer at gmail.com (Ilya Flyamer) Date: Wed, 30 May 2018 14:31:22 +0100 Subject: [Matplotlib-users] annotation arrow shrink In-Reply-To: References: Message-ID: Thanks Adrien, This is very helpful and pointed me towards a mistake I had made, thank you! I am still not sure why sometimes arrows of my annotations would start from the middle of the text and are not clipped, but I can't reproduce it in simple examples, so have to presume it's some strange side effect from my other code. Best, Ilya 2018-05-29 23:21 GMT+01:00 vincent.adrien at gmail.com < vincent.adrien at gmail.com>: > Hi Ilya, > > Using a null-value for `shrinkA` or `shrinkB` does not achieve what you > want? > > FWIW, I think that the method used under the hood by `FancyArrowPatch` is > located [here](https://github.com/matplotlib/matplotlib/blob/master/ > lib/matplotlib/patches.py#L2706), while the percentage-to-points > machinery in `Axes.annotate` (when *arrowstyle* is `None` and using the > *shrink* parameter) seems to start [there](https://github.com/mat > plotlib/matplotlib/blob/master/lib/matplotlib/text.py#L2128). > > Attached is a small snippet demonstrating both the percentage-based and > the point-based shrinking possibilities, in case this might help. > > Best, > Adrien > > > On 05/29/2018 11:20 AM, Ilya Flyamer wrote: > >> Hi all, >> >> I am trying to figure out how shrinkA works for arrows in annotations, >> and it seems very confusing from experimenting with it - is there an >> explanation somewhere online? >> I simply wanted to ensure that the arrow starts at the edge of the >> bounding box, but it's not so easy, it seems... Is this not the right way >> to do this, maybe? >> >> Thanks! >> >> Cheers, >> Ilya >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > > _______________________________________________ > 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 david.ketcheson at kaust.edu.sa Thu May 31 04:43:44 2018 From: david.ketcheson at kaust.edu.sa (David Ketcheson) Date: Thu, 31 May 2018 11:43:44 +0300 Subject: [Matplotlib-users] How to create an animation of complicated figures without writing each image to file Message-ID: I would like to create an animation from a very complicated plot. The plot is created by a lot of functions and it's not feasible for me to pass back the handles to all the objects that get added to the plot from all of those functions. One approach that works is to write each plot to a file and then create an animation by loading the images. Unfortunately, this doesn't look good, presumably because the images are first rasterized and then the resolution is altered. So I'd like to create an animation directly from a set of figures, when all I have are the figures. I've tried to use get_children() recursively to get all the artists and then use animation.ArtistAnimation(), but so far this only leads to an empty (blank) animation. Is it possible to do what I'm attempting? -David ________________________________ This message and its contents including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email. -------------- next part -------------- An HTML attachment was scrubbed... URL: From akhilesh.phy at mnit.ac.in Thu May 31 07:37:22 2018 From: akhilesh.phy at mnit.ac.in (Akhilesh Nautiyal) Date: Thu, 31 May 2018 17:07:22 +0530 Subject: [Matplotlib-users] Help needed to fill_between two curves In-Reply-To: <5d8df09b-7112-6b77-3b30-b686d2d3da73@gmail.com> References: <7788e64c-15eb-815b-85a6-d450901625e6@gmail.com> <5d8df09b-7112-6b77-3b30-b686d2d3da73@gmail.com> Message-ID: Dear Adrien, Thanks again for your kindly help. My problem is solved. I could get the plot I needed, which is attached here. I had to plot one more data file and had to use two fill_between calls. Regards, akhilesh On Wed, May 30, 2018 at 7:23 AM, vincent.adrien at gmail.com < vincent.adrien at gmail.com> wrote: > Akhilesh, > > I am not totally sure that I understand what is your remaining issue. To > me, it seems that it is just a matter of building the ?correct? common > abscissa vector to pass to ``fill_between``. See for example the attached > snippet for another kind of abscissa vector that would be possible and > maybe better suited to what you want. > > Regards, > Adrien > > On 05/28/2018 10:50 PM, Akhilesh Nautiyal wrote: > >> Dear Adrien, >> >> Thanks a lot for your kind help. With this I am getting an extra >> filled region as the abscissa of N_46 is getting extended. I will try to >> play around with this to find some solution. >> >> Regards, >> akhilesh >> >> On Fri, May 25, 2018 at 6:10 PM, vincent.adrien at gmail.com > vincent.adrien at gmail.com> > vincent.adrien at gmail.com>> wrote: >> >> Hi Akhilesh, >> >> Then I guess that you need to somehow interpolate your data to share >> the same abscissa values, at least for the ?fill between? step. I am >> not very used to do this kind of things but please find attached a >> script that may be helpful to you (it produces to attached PNG, with >> Matplotlib 2.2). It uses Numpy to perform linear interpolation of >> your data; scipy.interpolate may also be a good source of >> interpolation tools if this is not good enough for you. >> >> Best, >> Adrien >> >> PS : I also reattach the data files, to make it easier to play with >> the script if somebody else wanted to propose a better solution. >> >> On 05/25/2018 03:44 AM, Akhilesh Nautiyal wrote: >> >> Dear Adrien, >> >> Thanks for the reply. I have tried all that. Actually >> in my case the two curves have different size of abscissa and >> ordinates. Suppose I make arrays like x1, y1 and x2, y2 from >> two data files >> attached in my previous mail, the arrays x1 and x2 have >> different size and the arrays y1 and y2 have different size. >> I will be grateful if you can help me how to fill the area >> between these curves n this particular case. >> >> With Regards, >> akhilesh >> >> On Thu, May 24, 2018 at 10:24 PM, vincent.adrien at gmail.com >> >> > > > >> > >> >> wrote: >> >> Hi Akhliesh, >> >> For basic usage of Matpolotlib, the following tutorials may >> be good >> starting points: >> * >> https://matplotlib.org/tutorials/introductory/pyplot.html >> >> > > >> * >> https://matplotlib.org/tutorials/introductory/usage.html >> >> > > >> To enforce peculiar x- and y-ranges, I think that you may >> want to >> use `ax.set_xlim` and `ax.set_ylim` (or `plt.xlim` and >> `plt.ylim` if >> you prefer the interactive Pyplot interface rather than the >> object-oriented one). >> >> Besides, you may find the following example useful: >> https://matplotlib.org/gallery/lines_bars_and_markers/fill_ >> between_demo.html >> > between_demo.html> >> > y/lines_bars_and_markers/fill_between_demo.html >> > between_demo.html>> >> to learn how to fill the aerea between 2 curves. >> >> Hopefully this will help you a bit. >> >> Best regards, >> Adrien >> >> On 05/24/2018 05:13 AM, Akhilesh Nautiyal wrote: >> >> Dear Sir/Madam, >> >> I am plotting with matplotlib >> using two >> data files with different x and y ranges. I need to >> fill up the >> region between the two curves. I request you to kindly >> help me >> in this regard. I am attaching the files with >> this e-mail. the plot range should be between x->0.93 >> to 1.0 and >> y->0 to 0.25. >> >> Thanking you, >> Sincerely, >> akhliesh >> >> -- ***************************** >> ****************************************************************** >> * Dr. Akhilesh Nautiyal >> * Assistant Professor >> * Department of Physics >> * Malaviya National Institute of Technology Jaipur >> * JLN Marg Jaipur-302017 >> * Mo: +91-9 549657939 >> ****************************** >> ***************************************************************** >> >> >> This body part will be downloaded on demand. >> >> >> >> >> >> -- ***************************** >> ****************************************************************** >> * Dr. Akhilesh Nautiyal >> * Assistant Professor >> * Department of Physics >> * Malaviya National Institute of Technology Jaipur >> * JLN Marg Jaipur-302017 >> * Mo: +91-9 549657939 >> ************************************************************ >> *********************************** >> >> >> >> >> >> -- >> ************************************************************ >> *********************************** >> * Dr. Akhilesh Nautiyal >> * Assistant Professor >> * Department of Physics >> * Malaviya National Institute of Technology Jaipur >> * JLN Marg Jaipur-302017 >> * Mo: +91-9 549657939 >> ************************************************************ >> *********************************** >> > > -- *********************************************************************************************** * Dr. Akhilesh Nautiyal * Assistant Professor * Department of Physics * Malaviya National Institute of Technology Jaipur * JLN Marg Jaipur-302017 * Mo: +91-9 <%2B91-9445520847>549657939 *********************************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: filled_region.png Type: image/png Size: 24789 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: filling.py Type: text/x-python Size: 1435 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ns_r_N_46.dat Type: application/octet-stream Size: 8770 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ns_r_N_46_55.dat Type: application/octet-stream Size: 7 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ns_r_N_55.dat Type: application/octet-stream Size: 10149 bytes Desc: not available URL: From tcaswell at gmail.com Thu May 31 08:38:45 2018 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 31 May 2018 08:38:45 -0400 Subject: [Matplotlib-users] How to create an animation of complicated figures without writing each image to file In-Reply-To: References: Message-ID: If you have no control over the plotting functions, can not update the artists in place, or just have a sequence of Figure objects, the best approach is probably to so save each frame to png and then use an external program to (eg ffmpeg) stitch them together. Make sure that you are not using `bbox_inches='tight'`, tight_layour, or contrained layout (so every saved figure is the same size and the axes are in the same place). If you can re-use the same `Figure` object you can directly use the Writer classes is `matplotlib.animation`, see https://matplotlib.org/api/animation_api.html?highlight=animation#writer-classes . Those instances are bound to a particular Figure, you _may_ be able to just re-set the figure (but not sure what other state we hold based on the initial figure that might need to be updated as well), at a minimum they should be a good starting point to write your self a "concatenate a list of figures into a movie" writer. Tom On Thu, May 31, 2018 at 4:57 AM David Ketcheson < david.ketcheson at kaust.edu.sa> wrote: > I would like to create an animation from a very complicated plot. The > plot is created by a lot of functions and it's not feasible for me to pass > back the handles to all the objects that get added to the plot from all of > those functions. One approach that works is to write each plot to a file > and then create an animation by loading the images. Unfortunately, this > doesn't look good, presumably because the images are first rasterized and > then the resolution is altered. > > So I'd like to create an animation directly from a set of figures, when > all I have are the figures. I've tried to use get_children() recursively > to get all the artists and then use animation.ArtistAnimation(), but so > far this only leads to an empty (blank) animation. Is it possible to do > what I'm attempting? > > -David > > ------------------------------ > This message and its contents including attachments are intended solely > for the original recipient. If you are not the intended recipient or have > received this message in error, please notify me immediately and delete > this message from your computer system. Any unauthorized use or > distribution is prohibited. Please consider the environment before printing > this email. > _______________________________________________ > 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 tcaswell at gmail.com Thu May 31 09:19:45 2018 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 31 May 2018 09:19:45 -0400 Subject: [Matplotlib-users] How to create an animation of complicated figures without writing each image to file In-Reply-To: References: Message-ID: I do not know of a vector-based movie format, I think you have to rasterize at _some_ point. Try increasing the dpi or adjusting the encoding parameters / of ffmpeg (the defaults are not great for plots iirc). `to_jshtml` writes out movie file and then wraps it in minimal js player. Tom On Thu, May 31, 2018 at 9:14 AM David Ketcheson wrote: > Thanks for your help! My replies are interspersed below. > > On Thu, May 31, 2018 at 3:38 PM, Thomas Caswell > wrote: > >> If you have no control over the plotting functions, can not update the >> artists in place, or just have a sequence of Figure objects, the best >> approach is probably to so save each frame to png and then use an external >> program to (eg ffmpeg) stitch them together. Make sure that you are not >> using `bbox_inches='tight'`, tight_layour, or contrained layout (so every >> saved figure is the same size and the axes are in the same place). >> > > That's what I've been doing, but as I mentioned in my first message, the > output isn't what I want -- there are visible artifacts in the resulting > movie. Is there a way to do this without going to a rasterized graphics > format? > >> >> If you can re-use the same `Figure` object you can directly use the >> Writer classes is `matplotlib.animation`, see >> https://matplotlib.org/api/animation_api.html?highlight=animation#writer-classes . >> Those instances are bound to a particular Figure, you _may_ be able to just >> re-set the figure (but not sure what other state we hold based on the >> initial figure that might need to be updated as well), at a minimum they >> should be a good starting point to write your self a "concatenate a list of >> figures into a movie" writer. >> > > I don't want to write a movie file; my goal is to end up with a > JSAnimation-style output (i.e., what you get from anim.to_jshtml()). I > don't see a writer class for that. > > >> >> On Thu, May 31, 2018 at 4:57 AM David Ketcheson < >> david.ketcheson at kaust.edu.sa> wrote: >> >>> I would like to create an animation from a very complicated plot. The >>> plot is created by a lot of functions and it's not feasible for me to pass >>> back the handles to all the objects that get added to the plot from all of >>> those functions. One approach that works is to write each plot to a file >>> and then create an animation by loading the images. Unfortunately, this >>> doesn't look good, presumably because the images are first rasterized and >>> then the resolution is altered. >>> >>> So I'd like to create an animation directly from a set of figures, when >>> all I have are the figures. I've tried to use get_children() recursively >>> to get all the artists and then use animation.ArtistAnimation(), but so >>> far this only leads to an empty (blank) animation. Is it possible to do >>> what I'm attempting? >>> >>> -David >>> >>> ------------------------------ >>> This message and its contents including attachments are intended solely >>> for the original recipient. If you are not the intended recipient or have >>> received this message in error, please notify me immediately and delete >>> this message from your computer system. Any unauthorized use or >>> distribution is prohibited. Please consider the environment before printing >>> this email. >>> _______________________________________________ >>> 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 jerzy.karczmarczuk at unicaen.fr Thu May 31 13:00:45 2018 From: jerzy.karczmarczuk at unicaen.fr (Jerzy Karczmarczuk) Date: Thu, 31 May 2018 19:00:45 +0200 Subject: [Matplotlib-users] How to create an animation of complicated figures without writing each image to file In-Reply-To: References: Message-ID: <298801a4-f06c-5ead-85c6-cb7befd84edd@unicaen.fr> Le 31/05/2018 ? 14:38, Thomas Caswell answers the query of David Ketcheson : > If you have no control over the plotting functions, can not update the > artists in place, or just have a sequence of Figure objects, the best > approach is probably to so save each frame to png and then use an > external program to (eg ffmpeg) stitch them together. > > On Thu, May 31, 2018 at 4:57 AM David Ketcheson > > > wrote: > > I would like to create an animation from a very complicated plot.? > The plot is created by a lot of functions and it's not feasible > for me to pass back the handles to all the objects that get added > to the plot from all of those functions.? One approach that works > is to write each plot to a file and then create an animation by > loading the images.? Unfortunately, this doesn't look good, > presumably because the images are first rasterized and then the > resolution is altered. > > So I'd like to create an animation directly from a set of figures, > when all I have are the figures.? I've tried to use get_children() > recursively to get all the artists and then use > animation.ArtistAnimation(), but so far this only leads to an > empty (blank) animation. Is it possible to do what I'm attempting? > But you may save your figure as SVG as well, no? [Independently of Cairo; on a personal note: I use matplotlib under Anaconda on Windows 10. Cairo is a zombie, it is duly installed by conda, and then refuses to be imported. saying that it doesn't exist Anybody knows what's happening?...] The SVG produced by Matplotlib is fairly readable, and it can be even edited by hand, and Inkscape accepts it without frowning. == If, after several troubles, you decide to pass through the rasterization, perhaps there is no need to save PNGs, just dump your figure on the internal Python canvas and to its region buffer (as string / bytes), and compose using the internal numpy array combination routines. Regards. Jerzy Karczmarczuk /Caen, France/ -------------- next part -------------- An HTML attachment was scrubbed... URL: