You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(9) |
2
(1) |
3
(4) |
4
(4) |
5
(9) |
6
(5) |
7
(12) |
8
(5) |
9
(27) |
10
(10) |
11
(4) |
12
|
13
(6) |
14
(12) |
15
(16) |
16
(13) |
17
(9) |
18
(1) |
19
(2) |
20
(4) |
21
(9) |
22
(5) |
23
(2) |
24
(6) |
25
|
26
(1) |
27
(9) |
28
(7) |
29
(2) |
30
(9) |
|
|
From: Glenn N. <dev...@gl...> - 2011-06-20 22:52:54
|
I am encountering the same problem with fillcontinents that has been discussed here in the past: https://sourceforge.net/mailarchive/message.php?msg_id=22351355 I am using Basemap 1.0 in Python 2.4.3. fillcontinents sometimes fails and the entire map is the assigned ocean color, aqua. Jeff Whitaker suggested that I try drawlsmask or bluemarble methods of Basemap. Neither of these have worked for me, as explained below ... We do not have PIL (Python Image Library) installed and it is required for bluemarble and I don't have authority to install, so for now bluemarble cannot be used. Drawlsmask raises "ValueError: lons and lats must be increasing!". But they are increasing - here is an attempt to make a global map: m = Basemap(llcrnrlat=-85.0,llcrnrlon=0.0,urcrnrlat=85.0,urcrnrlon=360.0) m.drawlsmask() And this throws ValueError (so do other proper lat-long boundaries). So back to the problem with fillcontinents ... I have no problem on my development system - all maps are so far good. But on our operational system, some combinations of lat-long and figure size cause fillcontinents (or something else?) to fail. The original code reads like this: m = Basemap(llcrnrlat=-85.0,llcrnrlon=0.0,urcrnrlat=85.0,urcrnrlon=360.0) # global map, it is OK m.drawcoastlines() m.drawcountries(linewidth=1) m.drawmapboundary(fill_color='aqua') m.fillcontinents(color='coral') BTW, here are values that make it fail for me (north Atlantic region): m = Basemap(llcrnrlat=10.0,llcrnrlon=-100.0,urcrnrlat=70.0,urcrnrlon=15.0) and plt.figure(figsize=(2.0,1.043478)) If I shrink lat-lon boundaries by 1 degree (11,-99)(69,14) or change the figsize somewhat (but maintain aspect ratio), the continents will appear. If fillcontinents is the problem, then if I comment it out, shouldn't I get coastlines and countries (line drawings shouldn't be a problem)? I do on my dev system, but I still get solid 'aqua' on the operational system. |
From: Steve W. <pla...@gm...> - 2011-06-20 03:14:22
|
#---------------------------- import matplotlib.pyplot as plt ax = plt.subplot(1,1,1) x = [0.1, 0.3, 2.6, 3.3] y = [25.4, 18.9, 13.5, 12.6] ax.plot(x, y, marker="s", label='foo', linestyle="None") #ax.plot(x, y, marker="s", label='foo') #leg = ax.legend(numpoints=1, title='legend title') leg = ax.legend(title='legend title') print(leg.numpoints) plt.show() #---------------------------- Why does legend.numpoints default to 2? It looks much better when it's 1. I'm using matplotlib version 0.99.3. Steve |
From: Steve W. <pla...@gm...> - 2011-06-20 02:58:54
|
#---------------------------- import matplotlib.pyplot as plt ax = plt.subplot(1,1,1) ax.plot(1, 2, label='foo') ax.legend(numpoints=0) #---------------------------- Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 4044, in legend self.legend_ = mlegend.Legend(self, handles, labels, **kwargs) File "/usr/lib/pymodules/python2.7/matplotlib/legend.py", line 226, in __init__ raise ValueError("numpoints must be >= 0; it was %d"% numpoints) ValueError: numpoints must be >= 0; it was 0 The exception message doesn't match the condition that raises it. I think it should say "numpoints must be > 0". I'm using matplotlib version 0.99.3. Steve |
From: Benjamin R. <ben...@ou...> - 2011-06-20 00:14:41
|
On Sunday, June 19, 2011, Lukmanul Hakim <plg...@ya...> wrote: > Hello, > > I would like to ask for some hints > and help. I am currently trying to plot a "pseudo contour" over a Basemap. This contour is confined by borders obtained from a shapefile. I can generate the contour, I can retrieve the shapefile and put them on a basemap. What I have not been able to do is to limit the contour plot such that it only fills the area defined by a shapefile (in my case it is bordered by Province Lampung). You can use different shapefile for example, as the point of my question is how to limit contour fill by a shapefile. > > Shapefile can be downloaded from http://www.gadm.org/data/shp/IDN_adm.zip > > The generated figure can be found here: > https://lh3.googleusercontent.com/-hMlwe6MAjdc/Tf6HlxYxn1I/AAAAAAAAAEY/exdzSv30ZL4/s640/to_matplotlib_userlists.png > > Thanks for the help! > -- > Lukmanul Hakim > > Here's the code: > ---------------- > from pylab import cm > import matplotlib.pyplot as plt > import numpy as np > from mpl_toolkits.basemap import Basemap > > #Define area about Province Lampung > ulat, llat, ulon, llon = -2.5, -6.5, 107, 103 > m = Basemap(projection='merc', lon_0=0.0, llcrnrlon=llon, > llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, > resolution='i') > > > #Read shapefile of Province Lampung > s = m.readshapefile('E:/Works/UNILA/Research/IDN_adm/LampungMap/LampungMap', 'lampung') > > #Define area for contour plot > llon1,ulon1 = 103,106 > llat1,ulat1 = -6,-3.5 > > #Generate random data > nx,ny=5,5 > data2 = np.random.sample((ny,nx)) > x = np.linspace(llon1, ulon1, nx) > y = np.linspace(llat1, ulat1, ny) > X,Y = np.meshgrid(x,y) > px,py = m(X,Y) > m.contourf(px, py, data2, cmap=cm.jet) > m.drawcoastlines()#(linewidth=0.5) > m.drawparallels(np.arange(-6.5,-2.5,1.),labels=[1,0,0,0],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2) # draw parallels > m.drawmeridians(np.arange(102.,108.,1.),labels=[0,0,0,1],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2) # draw meridians > > plt.show() Not exactly sure how to do this, but if you can get a true/false mask of the region in the same shape as the input data, then you can have a masked array that goes into contourf. Any area where the mask was true will be blanked. The hard part, though is getting the mask. I hope that helps! Ben Root |
From: Lukmanul H. <plg...@ya...> - 2011-06-19 23:37:03
|
Hello, I would like to ask for some hints and help. I am currently trying to plot a "pseudo contour" over a Basemap. This contour is confined by borders obtained from a shapefile. I can generate the contour, I can retrieve the shapefile and put them on a basemap. What I have not been able to do is to limit the contour plot such that it only fills the area defined by a shapefile (in my case it is bordered by Province Lampung). You can use different shapefile for example, as the point of my question is how to limit contour fill by a shapefile. Shapefile can be downloaded from http://www.gadm.org/data/shp/IDN_adm.zip The generated figure can be found here: https://lh3.googleusercontent.com/-hMlwe6MAjdc/Tf6HlxYxn1I/AAAAAAAAAEY/exdzSv30ZL4/s640/to_matplotlib_userlists.png Thanks for the help! -- Lukmanul Hakim Here's the code: ---------------- from pylab import cm import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.basemap import Basemap #Define area about Province Lampung ulat, llat, ulon, llon = -2.5, -6.5, 107, 103 m = Basemap(projection='merc', lon_0=0.0, llcrnrlon=llon, llcrnrlat=llat, urcrnrlon=ulon, urcrnrlat=ulat, resolution='i') #Read shapefile of Province Lampung s = m.readshapefile('E:/Works/UNILA/Research/IDN_adm/LampungMap/LampungMap', 'lampung') #Define area for contour plot llon1,ulon1 = 103,106 llat1,ulat1 = -6,-3.5 #Generate random data nx,ny=5,5 data2 = np.random.sample((ny,nx)) x = np.linspace(llon1, ulon1, nx) y = np.linspace(llat1, ulat1, ny) X,Y = np.meshgrid(x,y) px,py = m(X,Y) m.contourf(px, py, data2, cmap=cm.jet) m.drawcoastlines()#(linewidth=0.5) m.drawparallels(np.arange(-6.5,-2.5,1.),labels=[1,0,0,0],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2) # draw parallels m.drawmeridians(np.arange(102.,108.,1.),labels=[0,0,0,1],color='black',dashes=[1,0],labelstyle='+/-',linewidth=0.2) # draw meridians plt.show() |
From: <mat...@xo...> - 2011-06-19 20:01:04
|
I am having trouble adding minor tick marks to an auto-scaled axis on a linear plot. I hope someone can help. I am drawing a plot where the X axis values are predictable, so I have the ability to define the desired major/minor intervals for tickmarks and gridlines. The scale of the X axis is automatically defined by matplotlib. I have manually specified the major and minor X axis tick/grid intervals using: plt.grid(True, which='both') XmajorLocator XmajorFormatter XminorLocator My Y axis values are not predictable, so I rely on matplotlib to autoscale the Y axis, automatically defining the total range of values plotted and the major tickmark & gridline intervals. I need more gridline resolution, so I would like to be able to add minor gridlines to the automatically scaled Y axis, but I'm having trouble doing it. At present the autoscaled Y axis is only producing major ticks and major gridlines. I'd like to add minor ticks and gridlines, but I have not been successful so far. I'm hoping that someone can point out an obvious solution that I've just overlooked. TIA. |
From: gerard h. <sol...@gm...> - 2011-06-18 05:29:58
|
hello, my message is related to this thread: http://sourceforge.net/mailarchive/message.php?msg_id=26923108 because i encountered the same problem, and found a workaround, hope this help: - i'm using solaris/opensolaris/solaris11express (the name is changing often...), say sunos5 - i compiled numpy and matplotlib with oracle studio (ex sunstudio), available for free - when i got these errors: ldd -d ./build/lib.solaris-2.11-i86pc-2.6/matplotlib/_delaunay.so libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 libdl.so.1 => /lib/libdl.so.1 libm.so.2 => /lib/libm.so.2 libc.so.1 => /lib/libc.so.1 symbol not found: __1cDstdJbad_allocG__vtbl_ (./build/lib.solaris-2.11-i86pc-2.6/matplotlib/_delaunay.so) symbol not found: __1cDstdJexceptionG__vtbl_ (./build/lib.solaris-2.11-i86pc-2.6/matplotlib/_delaunay.so) symbol not found: __1cDstdZ__RTTI__1nDstdJbad_alloc__ (./build/lib.solaris-2.11-i86pc-2.6/matplotlib/_delaunay.so) symbol not found: __1cDstdZ__RTTI__1nDstdJbad_alloc__ (./build/lib.solaris-2.11-i86pc-2.6/matplotlib/_delaunay.so) i found that the problem is missing libs, so i re-start the compil line like this: /usr/lib/python2.6/pyCC -G build/temp.solaris-2.11-i86pc-2.6/lib/matplotlib/delaunay/_delaunay.o build/temp.solaris-2.11-i86pc-2.6/lib/matplotlib/delaunay/VoronoiDiagramGenerator.o build/temp.solaris-2.11-i86pc-2.6/lib/matplotlib/delaunay/delaunay_utils.o build/temp.solaris-2.11-i86pc-2.6/lib/matplotlib/delaunay/natneighbors.o -L/opt/solstudio12.2/lib -lpython2.6 -o build/lib.solaris-2.11-i86pc-2.6/matplotlib/_delaunay.so *-lCstd -lCrun* just adding *-lCstd -lCrun*, and everything is now ok! i don't understand why setupext.py forgot to do this, even after modified it: --- setupext.py-ori 2011-06-17 21:43:24.259641908 +0200 +++ setupext.py 2011-06-18 06:49:59.375481456 +0200 @@ -68,7 +68,7 @@ 'freebsd4' : ['/usr/local', '/usr'], 'freebsd5' : ['/usr/local', '/usr'], 'freebsd6' : ['/usr/local', '/usr'], - 'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local', '/usr/sfw'], + 'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local', '/opt/solstudio12.2'], 'gnukfreebsd5' : ['/usr/local', '/usr'], 'gnukfreebsd6' : ['/usr/local', '/usr'], 'gnukfreebsd7' : ['/usr/local', '/usr'], @@ -238,6 +238,8 @@ win32_compiler = get_win32_compiler() if sys.platform == 'win32' and win32_compiler == 'msvc': std_libs = [] +elif sys.platform == 'sunos5': + std_libs = ['Cstd', 'Crun'] else: std_libs = ['stdc++', 'm'] hope this help, gerard |
From: Goyo <goy...@gm...> - 2011-06-17 22:42:13
|
2011/6/16 stefanie <lu...@go...>: > Hello! > > I'm plotting the river danube and some other stuff around it. Is there > an easy way to extract several rectangles around the river and plot this > rectangles next to each other? My aim is to print the whole river on a > paper. My idea is to cut a rectangle every 100km, turn it straight (but > marking North) and put all rectangles next/under each other. Or should I > plot everything and continue with an image library? You can add several maps to the print composer, then make each map show the region you want. Goyo |
From: Alain F. <fra...@it...> - 2011-06-17 16:10:32
|
By monitoring memory and time with the task manager it looks like there is no big difference. I'm aware that it should be monitored in a more rigourous way but I don't think it is really relevant since the main problem was solved using the Agg backend instead of the WXAgg that seems to have a memory leakage (see branch discussion with David). Fabrice Silva-2 wrote: > > Le vendredi 17 juin 2011 à 03:49 -0700, Alain Francés a écrit : >> > You can in fact remove the fig argument of the plot_density function as >> > it is not used. The clf command removes the children of the figure so >> > that it has to delete the axes and its children (amongst which is the >> > AxesImage) and create new ones when you invoke imshow again. >> >> I simply removed the clf command! >> It works now with this code (I just implemented fig.canvas.draw() as you >> indicated) > > So? what about timings and memory consumption? > -- > Fabrice Silva > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31870257.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Ivan L. <iv...@wh...> - 2011-06-17 15:09:29
|
Is there a way to add stippling or hash marks to areas on a geographical map? I have a mask of zeros and ones and I'd like the areas where mask = 1 to be stippled. I'm using basemap to create the global map. Thanks, -- Ivan Lima Woods Hole Oceanographic Institution, MC&G MS #25 360 Woods Hole Road, Woods Hole, MA 02543-1543 USA |
From: Fabrice S. <si...@lm...> - 2011-06-17 12:30:54
|
Le vendredi 17 juin 2011 à 03:49 -0700, Alain Francés a écrit : > > You can in fact remove the fig argument of the plot_density function as > > it is not used. The clf command removes the children of the figure so > > that it has to delete the axes and its children (amongst which is the > > AxesImage) and create new ones when you invoke imshow again. > > I simply removed the clf command! > It works now with this code (I just implemented fig.canvas.draw() as you > indicated) So? what about timings and memory consumption? -- Fabrice Silva |
From: Alain F. <fra...@it...> - 2011-06-17 10:49:45
|
> You can in fact remove the fig argument of the plot_density function as > it is not used. The clf command removes the children of the figure so > that it has to delete the axes and its children (amongst which is the > AxesImage) and create new ones when you invoke imshow again. I simply removed the clf command! It works now with this code (I just implemented fig.canvas.draw() as you indicated): # BOF import os, tempfile import matplotlib.pyplot as plt import numpy as np import matplotlib as mpl print '\nBackend:\n' + mpl.get_backend() + '\n' def plot_density(filename,i,t,psi_Na, image): if image is None: image = plt.imshow(abs(psi_Na)**2,origin = 'lower') else: image.set_data(abs(psi_Na)**2) fig.canvas.draw() filename = os.path.join(tempfile.gettempdir(), filename + '_%04d.png'%i) plt.savefig(filename) return image if __name__ == "__main__": x = np.linspace(-6e-6,6e-6,128,endpoint=False) y = np.linspace(-6e-6,6e-6,128,endpoint=False) X,Y = np.meshgrid(x,y) k = 1000000 omega = 200 times = np.linspace(0,100e-3,100,endpoint=False) fig = plt.figure(figsize=(8,6)) image = None for i,t in enumerate(times): psi_Na = np.sin(k*X-omega*t) image = plot_density('wavefunction',i,t,psi_Na, image) print i del image, fig plt.close() # EOF Fabrice Silva-2 wrote: > > Le vendredi 17 juin 2011 à 02:38 -0700, Alain Francés a écrit : >> Hi, >> >> This way the code creates empty images, it needs indeed some update where >> you inserted the comment. However I'm not sure that the benefit in >> term of memory and speed will be important. > > I would think it would avoid creating a new instance of AxesImage and > calling garbage collector to destroy previous one (if no reference is > kept) or accumulating children of the figure (if reference to previous > AxesImages is kept by a parent object). > > Update is done by fig.canvas.draw() (to be put where the comment is) > >> PS: I slightly changed the code below since as Jakob noticed: "since you >> just use one figure object and don't switch it it is not necessary to >> pass >> the object to the plot method - it remains active anyway." > > You can in fact remove the fig argument of the plot_density function as > it is not used. The clf command removes the children of the figure so > that it has to delete the axes and its children (amongst which is the > AxesImage) and create new ones when you invoke imshow again. > > -- > Fabrice Silva > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31867966.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Fabrice S. <si...@lm...> - 2011-06-17 10:23:13
|
Le vendredi 17 juin 2011 à 12:00 +0200, Fabrice Silva a écrit : > Le vendredi 17 juin 2011 à 02:38 -0700, Alain Francés a écrit : > > Hi, > > > > This way the code creates empty images, it needs indeed some update where > > you inserted the comment. However I'm not sure that the benefit in > > term of memory and speed will be important. In fact it creates empty images because of the clf command! Image data is modified but it no more related to the figure... -- Fabrice Silva |
From: Fabrice S. <si...@lm...> - 2011-06-17 10:00:26
|
Le vendredi 17 juin 2011 à 02:38 -0700, Alain Francés a écrit : > Hi, > > This way the code creates empty images, it needs indeed some update where > you inserted the comment. However I'm not sure that the benefit in > term of memory and speed will be important. I would think it would avoid creating a new instance of AxesImage and calling garbage collector to destroy previous one (if no reference is kept) or accumulating children of the figure (if reference to previous AxesImages is kept by a parent object). Update is done by fig.canvas.draw() (to be put where the comment is) > PS: I slightly changed the code below since as Jakob noticed: "since you > just use one figure object and don't switch it it is not necessary to pass > the object to the plot method - it remains active anyway." You can in fact remove the fig argument of the plot_density function as it is not used. The clf command removes the children of the figure so that it has to delete the axes and its children (amongst which is the AxesImage) and create new ones when you invoke imshow again. -- Fabrice Silva |
From: Alain F. <fra...@it...> - 2011-06-17 09:38:33
|
Hi, This way the code creates empty images, it needs indeed some update where you inserted the comment. However I'm not sure that the benefit in term of memory and speed will be important. A. PS: I slightly changed the code below since as Jakob noticed: "since you just use one figure object and don't switch it it is not necessary to pass the object to the plot method - it remains active anyway." Fabrice Silva-2 wrote: > > Le jeudi 16 juin 2011 à 07:47 -0700, Alain Francés a écrit : >> Hi Jakob, >> >> yes your solution works and is more elegant! See the code at the end of >> this >> message. >> However using the original code with the Agg backend instead of WXAgg >> also >> works fine, so there is probably a memory leakage problem with WXAgg (see >> the post of David and my reply). >> Thank for your reply and suggestion! > > Have you tried to go further and reuse the AxesImage instance created by > imshow? The API is quite not accessible on official matplotlib > documentation but exists (in the matplotlib.image module) > > CODE > # BOF > import os, tempfile > import matplotlib.pyplot as plt > import numpy as np > import matplotlib as mpl > print '\nBackend:\n' + mpl.get_backend() + '\n' > > def plot_density(filename,i,t,psi_Na, image): > if image is None: > image = plt.imshow(abs(psi_Na)**2,origin = 'lower') > else: > image.set_data(abs(psi_Na)**2) > # Maybe needs some update here. > filename = os.path.join(tempfile.gettempdir(), filename + > '_%04d.png'%i) > plt.savefig(filename) > plt.clf() > return image > > if __name__ == "__main__": > x = np.linspace(-6e-6,6e-6,128,endpoint=False) > y = np.linspace(-6e-6,6e-6,128,endpoint=False) > X,Y = np.meshgrid(x,y) > k = 1000000 > omega = 200 > times = np.linspace(0,100e-3,100,endpoint=False) > fig = plt.figure(figsize=(8,6)) > image = None > for i,t in enumerate(times): > psi_Na = np.sin(k*X-omega*t) > image = plot_density('wavefunction',i,t,psi_Na, image) > print i > plt.close() > # EOF > -- > Fabrice Silva > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31867626.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Fabrice S. <si...@lm...> - 2011-06-17 08:35:40
|
Le jeudi 16 juin 2011 à 07:47 -0700, Alain Francés a écrit : > Hi Jakob, > > yes your solution works and is more elegant! See the code at the end of this > message. > However using the original code with the Agg backend instead of WXAgg also > works fine, so there is probably a memory leakage problem with WXAgg (see > the post of David and my reply). > Thank for your reply and suggestion! Have you tried to go further and reuse the AxesImage instance created by imshow? The API is quite not accessible on official matplotlib documentation but exists (in the matplotlib.image module) CODE # BOF import os, tempfile import matplotlib.pyplot as plt import numpy as np import matplotlib as mpl print '\nBackend:\n' + mpl.get_backend() + '\n' def plot_density(filename,i,t,psi_Na, fig, image): if image is None: image = plt.imshow(abs(psi_Na)**2,origin = 'lower') else: image.set_data(abs(psi_Na)**2) # Maybe needs some update here. filename = os.path.join(tempfile.gettempdir(), filename + '_%04d.png'%i) plt.savefig(filename) plt.clf() return image if __name__ == "__main__": x = np.linspace(-6e-6,6e-6,128,endpoint=False) y = np.linspace(-6e-6,6e-6,128,endpoint=False) X,Y = np.meshgrid(x,y) k = 1000000 omega = 200 times = np.linspace(0,100e-3,100,endpoint=False) fig = plt.figure(figsize=(8,6)) image = None for i,t in enumerate(times): psi_Na = np.sin(k*X-omega*t) image = plot_density('wavefunction',i,t,psi_Na, fig, image) print i plt.close() # EOF -- Fabrice Silva |
From: Russell E. O. <ro...@uw...> - 2011-06-16 18:51:20
|
In article <BANLkTi=bj2...@ma...>, Rebecca Gray <atl...@gm...> wrote: > I am trying to install matplotlib on my Mac OS X 10.6.6. I currently have > Python 2.7.2 installed. I tried installing > ***matplotlib-1.0.1-python.org-32bit-py2.7-macosx10.3.dmg. > The installation appears to run fine, but when I try to import pylab * I am > getting the following error message: > > >>> from numpy import * > >>> import pylab >... > ImportError: > dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-pa > ckages/matplotlib/_path.so, > 2): no suitable image found. Did find: > > /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ > matplotlib/_path.so: > no matching architecture in universal wrapper > > I am new to Python and any help would be greatly appreciated. > > Thanks, > > Rebecca Which Python 2.7.2 are you using? The matplotlib installer is only compatible with the 32-bit version from python.org and I suspect you are using the 64-bit version or some other distribution entirely. If you are definitely using the 32-bit python.org version then could you please execute the "file" command on _path.so? When I do that for mine I get: d-172-28-191-121:matplotlib rowen$ file _path.so _path.so: Mach-O universal binary with 2 architectures _path.so (for architecture ppc): Mach-O bundle ppc _path.so (for architecture i386): Mach-O bundle i386 -- Russell |
From: Eric F. <ef...@ha...> - 2011-06-16 17:42:41
|
On 06/16/2011 04:31 AM, zb wrote: > line 1245 of cbook.py is missing the windows platform. So windows cannot > be tested. > In the development version of mpl it can (I added it--but too recently for it to have gotten into 1.0.1), provided you have the "tasklist" executable, which I think is a free download from Microsoft. If you would like to try it, you could include the new version, below, in your test script. Eric def report_memory(i=0): # argument may go away 'return the memory consumed by process' from subprocess import Popen, PIPE pid = os.getpid() if sys.platform=='sunos5': a2 = Popen('ps -p %d -o osz' % pid, shell=True, stdout=PIPE).stdout.readlines() mem = int(a2[-1].strip()) elif sys.platform.startswith('linux'): a2 = Popen('ps -p %d -o rss,sz' % pid, shell=True, stdout=PIPE).stdout.readlines() mem = int(a2[1].split()[1]) elif sys.platform.startswith('darwin'): a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True, stdout=PIPE).stdout.readlines() mem = int(a2[1].split()[0]) elif sys.platform.startswith('win'): try: a2 = Popen(["tasklist", "/nh", "/fi", "pid eq %d" % pid], stdout=PIPE).stdout.read() except OSError: raise NotImplementedError( "report_memory works on Windows only if " "the 'tasklist' program is found") mem = int(a2.strip().split()[-2].replace(',','')) else: raise NotImplementedError( "We don't have a memory monitor for %s" % sys.platform) return mem |
From: stefanie <lu...@go...> - 2011-06-16 15:47:55
|
Hello! I'm plotting the river danube and some other stuff around it. Is there an easy way to extract several rectangles around the river and plot this rectangles next to each other? My aim is to print the whole river on a paper. My idea is to cut a rectangle every 100km, turn it straight (but marking North) and put all rectangles next/under each other. Or should I plot everything and continue with an image library? Any help is appreciated! Kind regards Stefanie |
From: Alain F. <fra...@it...> - 2011-06-16 14:47:47
|
Hi Jakob, yes your solution works and is more elegant! See the code at the end of this message. However using the original code with the Agg backend instead of WXAgg also works fine, so there is probably a memory leakage problem with WXAgg (see the post of David and my reply). Thank for your reply and suggestion! Alain CODE # BOF import os, tempfile import matplotlib.pyplot as plt import numpy as np import matplotlib as mpl print '\nBackend:\n' + mpl.get_backend() + '\n' def plot_density(filename,i,t,psi_Na, fig): plt.imshow(abs(psi_Na)**2,origin = 'lower') filename = os.path.join(tempfile.gettempdir(), filename + '_%04d.png'%i) plt.savefig(filename) plt.clf() if __name__ == "__main__": x = np.linspace(-6e-6,6e-6,128,endpoint=False) y = np.linspace(-6e-6,6e-6,128,endpoint=False) X,Y = np.meshgrid(x,y) k = 1000000 omega = 200 times = np.linspace(0,100e-3,100,endpoint=False) fig = plt.figure(figsize=(8,6)) for i,t in enumerate(times): psi_Na = np.sin(k*X-omega*t) plot_density('wavefunction',i,t,psi_Na, fig) print i plt.close() # EOF Jakob Gager wrote: > > Hi, > > I'm not sure if it helps, but you can try to plot always into the same > figure object instead of creating a new one every time you call the > plot_density function. > > I would create one figure in advance and pass this the plot_density > method. Within the method set the figure active (pl.figure(fig.number)), > plot the data, save the figure and clear the figure canvas (pl.clf() > should work here, I guess). > Well, as mentioned I'm not sure but you could give it a try. > > br > Jakob > > Alain Francés wrote: >> Hi, http://old.nabble.com/file/p31858795/ErrorMsg.png >> >> indeed I forgot to remove these line from previous tests, sorry. >> >> However it doesn't affect the code behaviour, the problem remains (it >> fills >> the RAM memory and raises a memory error, see img in att.). >> >> Alain >> >> >> Davidmh wrote: >>> You are importing pylab again before each plot. You have loaded it >>> before. >>> >>> for i,t in enumerate(times): >>> import pylab as pl # <--ERASE THIS >>> >>> >>> >>> On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances >>> <fra...@it...> wrote: >>>> Hi, >>>> >>>> I have a script that creates and saves figures in a loop. The memory is >>>> increasing at each figure and is not released back, rising a Memory >>>> error. >>>> I used the close() function on the figure object as well as >>>> gc.collect(), >>>> but no effect. >>>> >>>> I searched on the net and found a similar problem at >>>> http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size. >>>> The problem here was solved using the close() function but in my case, >>>> as >>>> refered before, it doens't work (see code below). >>>> >>>> I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on >>>> windows7. >>>> >>>> Thanks for help! >>>> >>>> Alain >>>> >>>> >>>> CODE: >>>> >>>> import pylab as pl >>>> import os, tempfile >>>> def plot_density(filename,i,t,psi_Na): >>>> pl.figure(figsize=(8,6)) >>>> pl.imshow(abs(psi_Na)**2,origin = 'lower') >>>> filename = os.path.join(tempfile.gettempdir(), filename + >>>> '_%04d.png'%i) >>>> pl.savefig(filename) >>>> pl.clf() >>>> pl.close() >>>> if __name__ == "__main__": >>>> x = pl.linspace(-6e-6,6e-6,128,endpoint=False) >>>> y = pl.linspace(-6e-6,6e-6,128,endpoint=False) >>>> X,Y = pl.meshgrid(x,y) >>>> k = 1000000 >>>> omega = 200 >>>> times = pl.linspace(0,100e-3,100,endpoint=False) >>>> for i,t in enumerate(times): >>>> import pylab as pl >>>> psi_Na = pl.sin(k*X-omega*t) >>>> plot_density('wavefunction',i,t,psi_Na) >>>> print i >>>> ------------------------------------------------------------------------------ > > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31861342.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Alain F. <fra...@it...> - 2011-06-16 14:37:41
|
Hi, I'm using WXAgg by default because I developped an application with GUI using wxpython. But in this case indeed I don't need WXAgg and substituting WXAgg by Agg just work fine, both in the code I submitted as example (see the corrected code at the end) and in the one I'm working with. So yes, probably there is a memory leakage using WXAgg that, as you say, can be an interesting problem for the experts! Thank you very much for your wise solution (if you are interested, see also the comment of Jakob and my reply, he proposed an elegant solution still using WXAgg). Alain CORRECTED CODE: # BOF import os, tempfile import matplotlib as mpl if mpl.get_backend<>'agg': mpl.use('agg') import matplotlib.pyplot as plt import numpy as np print '\nBackend:\n' + mpl.get_backend() + '\n' def plot_density(filename,i,t,psi_Na): plt.figure(figsize=(8,6)) plt.imshow(abs(psi_Na)**2,origin = 'lower') filename = os.path.join(tempfile.gettempdir(), filename + '_%04d.png'%i) plt.savefig(filename) plt.close() if __name__ == "__main__": x = np.linspace(-6e-6,6e-6,128,endpoint=False) y = np.linspace(-6e-6,6e-6,128,endpoint=False) X,Y = np.meshgrid(x,y) k = 1000000 omega = 200 times = np.linspace(0,100e-3,500,endpoint=False) for i,t in enumerate(times): psi_Na = np.sin(k*X-omega*t) plot_density('wavefunction',i,t,psi_Na) print i # EOF Davidmh wrote: > > I can run the script you provided up to 600 without noticing any > memory growth (TkAgg backend by default). Using the WxAgg, the memory > leak appears. > > If you don't explicitly need WxAgg, I would recommend using TkAgg, or > better Agg if you are not showing the figures. If it is not the case, > more expert and wiser people will have to come to help. > > > On Thu, Jun 16, 2011 at 11:41 AM, Alain Francés <fra...@it...> > wrote: >> >> Hi, http://old.nabble.com/file/p31858795/ErrorMsg.png >> >> indeed I forgot to remove these line from previous tests, sorry. >> >> However it doesn't affect the code behaviour, the problem remains (it >> fills >> the RAM memory and raises a memory error, see img in att.). >> >> Alain >> >> >> Davidmh wrote: >>> >>> You are importing pylab again before each plot. You have loaded it >>> before. >>> >>> for i,t in enumerate(times): >>> import pylab as pl # <--ERASE THIS >>> >>> >>> >>> On Wed, Jun 15, 2011 at 12:10 PM, Alain Pascal Frances >>> <fra...@it...> wrote: >>>> Hi, >>>> >>>> I have a script that creates and saves figures in a loop. The memory is >>>> increasing at each figure and is not released back, rising a Memory >>>> error. >>>> I used the close() function on the figure object as well as >>>> gc.collect(), >>>> but no effect. >>>> >>>> I searched on the net and found a similar problem at >>>> http://stackoverflow.com/questions/3623600/python-matplotlib-memory-not-being-released-when-specifying-figure-size. >>>> The problem here was solved using the close() function but in my case, >>>> as >>>> refered before, it doens't work (see code below). >>>> >>>> I'm using Python 2.6.6, matplotlib 1.0.1, WXagg as backend, on >>>> windows7. >>>> >>>> Thanks for help! >>>> >>>> Alain >>>> >>>> >>>> CODE: >>>> >>>> import pylab as pl >>>> import os, tempfile >>>> def plot_density(filename,i,t,psi_Na): >>>> pl.figure(figsize=(8,6)) >>>> pl.imshow(abs(psi_Na)**2,origin = 'lower') >>>> filename = os.path.join(tempfile.gettempdir(), filename + >>>> '_%04d.png'%i) >>>> pl.savefig(filename) >>>> pl.clf() >>>> pl.close() >>>> if __name__ == "__main__": >>>> x = pl.linspace(-6e-6,6e-6,128,endpoint=False) >>>> y = pl.linspace(-6e-6,6e-6,128,endpoint=False) >>>> X,Y = pl.meshgrid(x,y) >>>> k = 1000000 >>>> omega = 200 >>>> times = pl.linspace(0,100e-3,100,endpoint=False) >>>> for i,t in enumerate(times): >>>> import pylab as pl >>>> psi_Na = pl.sin(k*X-omega*t) >>>> plot_density('wavefunction',i,t,psi_Na) >>>> print i >>>> ------------------------------------------------------------------------------ >>>> EditLive Enterprise is the world's most technically advanced content >>>> authoring tool. Experience the power of Track Changes, Inline Image >>>> Editing and ensure content is compliant with Accessibility Checking. >>>> http://p.sf.net/sfu/ephox-dev2dev >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >>> >>> ------------------------------------------------------------------------------ >>> EditLive Enterprise is the world's most technically advanced content >>> authoring tool. Experience the power of Track Changes, Inline Image >>> Editing and ensure content is compliant with Accessibility Checking. >>> http://p.sf.net/sfu/ephox-dev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> >> -- >> View this message in context: >> http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31858795.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> EditLive Enterprise is the world's most technically advanced content >> authoring tool. Experience the power of Track Changes, Inline Image >> Editing and ensure content is compliant with Accessibility Checking. >> http://p.sf.net/sfu/ephox-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Memory-increasing-while-plotting-in-loop-tp31850163p31861233.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: zb <za...@ya...> - 2011-06-16 14:31:41
|
line 1245 of cbook.py is missing the windows platform. So windows cannot be tested. def report_memory(i=0): # argument may go away 'return the memory consumed by process' from subprocess import Popen, PIPE pid = os.getpid() if sys.platform=='sunos5': a2 = Popen('ps -p %d -o osz' % pid, shell=True, stdout=PIPE).stdout.readlines() mem = int(a2[-1].strip()) elif sys.platform.startswith('linux'): a2 = Popen('ps -p %d -o rss,sz' % pid, shell=True, stdout=PIPE).stdout.readlines() mem = int(a2[1].split()[1]) elif sys.platform.startswith('darwin'): a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True, stdout=PIPE).stdout.readlines() mem = int(a2[1].split()[0]) return mem --- On Thu, 6/16/11, zb <za...@ya...> wrote: From: zb <za...@ya...> Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak To: "Eric Firing" <ef...@ha...>, mat...@li... Date: Thursday, June 16, 2011, 10:15 AM Hi. Sorry but that program does not even run. I am using matplotlib-1.0.1.win32-py2.6.exe It breaks with the error (I had to modified a little to get the full error): UnboundLocalError: local variable 'mem' referenced before assignment Traceback (most recent call last): File... File "C:\Python26\lib\site-packages\matplotlib\cbook.py", line 1245, in report_memory return mem Looks like you are using a different matplotlib version. Cheers --- On Wed, 6/15/11, Eric Firing <ef...@ha...> wrote: From: Eric Firing <ef...@ha...> Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak To: mat...@li... Date: Wednesday, June 15, 2011, 7:46 PM On 06/15/2011 01:15 PM, zb wrote: > Hi > > You could try the example here: > > http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html > > Look at the memory grow. It does the same in my program. I added a call to cbook.report_memory, and shortened the timer to 0.1 seconds in the attached version. There is no memory leakage evident when I run this on my system. Eric > > Cheers > > --- On *Wed, 6/15/11, Eric Firing /<ef...@ha...>/* wrote: > > > From: Eric Firing <ef...@ha...> > Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak > To: mat...@li... > Date: Wednesday, June 15, 2011, 6:33 PM > > On 06/15/2011 12:13 PM, zb wrote: > > Hi > > > > I have a loop that updates a graph by calling > > > > self.fig.canvas.draw() > > > > But every time it updates the graph, the memory usage goes up. If the > > program runs for one hour, the memory is gone (things start to > run slow > > too). I've tried to close() objects but the only thing that > brings back > > the ram memory is to close the whole application. > > > > I have read this note in the documentation (but it applies to > pyplot): > > > > "If you are making a long sequence of figures, you need to be > aware of > > one more thing: the memory requiredfor a figure is not completely > > released until the figure is explicitly closed with close(). Deleting > > all references to the figure, and/or using the window manager to kill > > the window in which the figure appears on the screen, is not enough, > > because pyplot maintains internal references until close() is > called." > > > > What could I do in pyqt4 to release the memory? > > > > Thanks > > Please provide a simple standalone script that demonstrates the problem. > > Eric > -----Inline Attachment Follows----- ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev -----Inline Attachment Follows----- _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users -----Inline Attachment Follows----- ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev -----Inline Attachment Follows----- _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: zb <za...@ya...> - 2011-06-16 14:15:35
|
Hi. Sorry but that program does not even run. I am using matplotlib-1.0.1.win32-py2.6.exe It breaks with the error (I had to modified a little to get the full error): UnboundLocalError: local variable 'mem' referenced before assignment Traceback (most recent call last): File... File "C:\Python26\lib\site-packages\matplotlib\cbook.py", line 1245, in report_memory return mem Looks like you are using a different matplotlib version. Cheers --- On Wed, 6/15/11, Eric Firing <ef...@ha...> wrote: From: Eric Firing <ef...@ha...> Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak To: mat...@li... Date: Wednesday, June 15, 2011, 7:46 PM On 06/15/2011 01:15 PM, zb wrote: > Hi > > You could try the example here: > > http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html > > Look at the memory grow. It does the same in my program. I added a call to cbook.report_memory, and shortened the timer to 0.1 seconds in the attached version. There is no memory leakage evident when I run this on my system. Eric > > Cheers > > --- On *Wed, 6/15/11, Eric Firing /<ef...@ha...>/* wrote: > > > From: Eric Firing <ef...@ha...> > Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak > To: mat...@li... > Date: Wednesday, June 15, 2011, 6:33 PM > > On 06/15/2011 12:13 PM, zb wrote: > > Hi > > > > I have a loop that updates a graph by calling > > > > self.fig.canvas.draw() > > > > But every time it updates the graph, the memory usage goes up. If the > > program runs for one hour, the memory is gone (things start to > run slow > > too). I've tried to close() objects but the only thing that > brings back > > the ram memory is to close the whole application. > > > > I have read this note in the documentation (but it applies to > pyplot): > > > > "If you are making a long sequence of figures, you need to be > aware of > > one more thing: the memory requiredfor a figure is not completely > > released until the figure is explicitly closed with close(). Deleting > > all references to the figure, and/or using the window manager to kill > > the window in which the figure appears on the screen, is not enough, > > because pyplot maintains internal references until close() is > called." > > > > What could I do in pyqt4 to release the memory? > > > > Thanks > > Please provide a simple standalone script that demonstrates the problem. > > Eric > -----Inline Attachment Follows----- ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev -----Inline Attachment Follows----- _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Jae-Joon L. <lee...@gm...> - 2011-06-16 12:21:45
|
On Tue, Jun 14, 2011 at 4:58 AM, Nicholas Devenish <mis...@gm...> wrote: > Is there a way I can avoid or correct this behaviour? It certainly > seems erroneous that using the figure GUI to adjust plot bounds > doesn't work, and is an especially nice way of tweaking for final > plots. > Unfortunately no. This is a limitation of how colobar is currently implemented (v1.1 will have a workaround to this). I think the simple (but may not be good enough) workaround is to call "colorbar" after subplot adjusting is done. Alternatively, you may try the axes_grid1 toolkit. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#colorbar-whose-height-or-width-in-sync-with-the-master-axes Regards, -JJ |
From: Jae-Joon L. <lee...@gm...> - 2011-06-16 12:11:21
|
Thanks. I fixed it in in the master branch. https://github.com/matplotlib/matplotlib/commit/649df91f8e0bb77687be0711d64201904bcdde67 Regards, -JJ On Wed, Jun 15, 2011 at 7:04 AM, Uri Laserson <las...@mi...> wrote: > In the Legend Guide: > http://matplotlib.sourceforge.net/users/legend_guide.html > it gives a list of artists that the legend can handle (e.g., Line2D, Patch, > etc.). However, it leaves out CircleCollection. > Best, > Uri > > ................................................................................... > Uri Laserson > Graduate Student, Biomedical Engineering > Harvard-MIT Division of Health Sciences and Technology > M +1 917 742 8019 > las...@mi... > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |