SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(4)
2
(13)
3
(4)
4
(6)
5
(6)
6
7
8
(6)
9
(2)
10
(2)
11
(3)
12
(3)
13
(2)
14
(2)
15
(2)
16
(6)
17
(8)
18
(10)
19
(17)
20
(8)
21
(4)
22
(10)
23
(7)
24
(7)
25
(8)
26
(11)
27
(5)
28
29
(5)
30
31
(4)



Showing 2 results of 2

From: Allan N. E. <all...@gm...> - 2006年05月14日 13:20:13
Can I implement realtime plotting in matplotlib? The data will be coming
from the serial port. The plotting will be similar to an oscilloscope. Can
you suggest matplotlib modules I can use for this particular application.
Thanks
From: <cl...@pe...> - 2006年05月14日 11:59:41
All,
I followed up the 'memory leak' discussion in the sourceforge list
and I know the Matplotlib-FAQ entry about this subject. I've also
seen John Hunter's post about the need of matching figure/close pairs.
Anyway, I still feel that there are problems in this subject, which
can be exposed by the following script (for Windows, but can easily
be adapted to Unix).
As can be seen by the results (also given below), there is a steady
increase in memory usage which is not recovered!
Any clues????
Clovis
######################################################################
#Begin of script
######################################################################
import pylab
import os
import time
N =3D 10 # number of loops to execute
SAVEFIG =3D True # SAVEFIG execution flag
SHOWFIG =3D True # SHOWFIG execution flag
pylab.matplotlib.use('TkAgg')
#pylab.matplotlib.use('Agg')
#pylab.matplotlib.use('PS')
fid =3D file('memory_report.txt','wt')
fid.write('%s\n' % time.asctime())
fid.write('OS version =3D %s\n' % os.sys.version)
fid.write('Matplotlib version =3D %s\n' % pylab.matplotlib.__version__)
fid.write('Matplotlib revision =3D %s\n' % pylab.matplotlib.__revision__)
fid.write('Matplotlit backend =3D %s\n' % pylab.matplotlib.get_backend()=
)
fid.write('Column #0 =3D figure index\n')
fid.write('Column #1 =3D memory usage before figure\n')
fid.write('Column #2 =3D memory usage after figure\n')
fid.write('Column #3 =3D (after-before) memory\n')
pylab.ion()
a=3Dpylab.arange(0,10)
def report_memory():
 ### Attention: the path to the pslist utility should be adjusted
according to installation!
 ### pslist.exe is a small utility that does the same as ps in Unix!
 ### It can be found at www.sysinternals.com/Utilities/PsList.html
 if os.sys.platform =3D=3D 'win32':
 ps_exe_filename =3D os.path.join(os.getcwd(),'pslist.exe') #Bu=
ild
ps filename
 a =3D os.popen('%s -m python' % ps_exe_filename).readlines() #Bu=
ild
and execute command
 b =3D a[8]
 c =3D b.split()
 return int(c[3])
 else:
 print 'Sorry, you have to adapt the command for your OS!'
 return 0
def figureloop(N):
 for i in range(0,N):
 memory_usage_before =3D report_memory()
 fid.write('Memory usage before/after figure[%2d] =3D %8d' % (i,
memory_usage_before))
 pylab.figure(i)
 pylab.plot(a,2*a)
 figurename =3D 'fig%02d.eps' % i
 if SAVEFIG:
 pylab.savefig(figurename)
 if SHOWFIG:
 pylab.show()
 pylab.close(i)
 time.sleep(1.0) # wait 1.0 second before
inspecting memory usage
 if os.path.isfile(figurename): # remove figure ...
 os.remove(figurename)
 memory_usage_after =3D report_memory()
 delta_memory =3D memory_usage_after - memory_usage_before
 fid.write(' %8d %8d\n' % (memory_usage_after, delta_memory))
 print '%2d %6d %6d %6d' % (i, memory_usage_before,
memory_usage_after, delta_memory)
print 'Column #0 =3D figure index'
print 'Column #1 =3D memory usage before figure'
print 'Column #2 =3D memory usage after figure'
print 'Column #3 =3D (after-before) memory'
print 'There is a sleep time of 1s between each figure!'
print 'Close Figure[0] to continue execution!'
SAVEFIG =3D True # SAVEFIG execution flag
SHOWFIG =3D False # SHOWFIG execution flag
print('\nConfiguration SHOWFIG=3D%s SAVEFIG=3D%s' % (SHOWFIG, SAVEFIG))
fid.write('\nConfiguration SHOWFIG=3D%s SAVEFIG=3D%s\n' % (SHOWFIG, SAVE=
FIG))
figureloop(N)
SAVEFIG =3D False # SAVEFIG execution flag
SHOWFIG =3D True # SHOWFIG execution flag
print('\nConfiguration SHOWFIG=3D%s SAVEFIG=3D%s' % (SHOWFIG, SAVEFIG))
fid.write('\nConfiguration SHOWFIG=3D%s SAVEFIG=3D%s\n' % (SHOWFIG, SAVE=
FIG))
figureloop(N)
SAVEFIG =3D True # SAVEFIG execution flag
SHOWFIG =3D True # SHOWFIG execution flag
print('\nConfiguration SHOWFIG=3D%s SAVEFIG=3D%s' % (SHOWFIG, SAVEFIG))
fid.write('\nConfiguration SHOWFIG=3D%s SAVEFIG=3D%s\n' % (SHOWFIG, SAVE=
FIG))
figureloop(N)
######################################################################
#End of script
######################################################################
######################################################################
#The results obtained
######################################################################
Sun May 14 08:35:09 2006
OS version =3D 2.4.2 (#67, Oct 30 2005, 16:11:18) [MSC v.1310 32
bit (Intel)]
Matplotlib version =3D 0.86.2
Matplotlib revision =3D $Revision: 1.104 $
Matplotlit backend =3D TkAgg
Column #0 =3D figure index
Column #1 =3D memory usage before figure
Column #2 =3D memory usage after figure
Column #3 =3D (after-before) memory
Configuration SHOWFIG=3DFalse SAVEFIG=3DTrue
Memory usage before/after figure[ 0] =3D 15632 20168 4536
Memory usage before/after figure[ 1] =3D 20172 22532 2360
Memory usage before/after figure[ 2] =3D 22532 24912 2380
Memory usage before/after figure[ 3] =3D 24912 27256 2344
Memory usage before/after figure[ 4] =3D 27256 29700 2444
Memory usage before/after figure[ 5] =3D 29700 31980 2280
Memory usage before/after figure[ 6] =3D 31980 34328 2348
Memory usage before/after figure[ 7] =3D 34328 36696 2368
Memory usage before/after figure[ 8] =3D 36696 39052 2356
Memory usage before/after figure[ 9] =3D 39052 43160 4108
Configuration SHOWFIG=3DTrue SAVEFIG=3DFalse
Memory usage before/after figure[ 0] =3D 43160 43796 636
Memory usage before/after figure[ 1] =3D 43796 46080 2284
Memory usage before/after figure[ 2] =3D 46080 48392 2312
Memory usage before/after figure[ 3] =3D 48392 50736 2344
Memory usage before/after figure[ 4] =3D 50736 53020 2284
Memory usage before/after figure[ 5] =3D 53020 55420 2400
Memory usage before/after figure[ 6] =3D 55420 57672 2252
Memory usage before/after figure[ 7] =3D 57672 59984 2312
Memory usage before/after figure[ 8] =3D 59984 62312 2328
Memory usage before/after figure[ 9] =3D 62312 64620 2308
Configuration SHOWFIG=3DTrue SAVEFIG=3DTrue
Memory usage before/after figure[ 0] =3D 64620 68460 3840
Memory usage before/after figure[ 1] =3D 68460 70564 2104
Memory usage before/after figure[ 2] =3D 70564 71992 1428
Memory usage before/after figure[ 3] =3D 71992 75752 3760
Memory usage before/after figure[ 4] =3D 75752 77612 1860
Memory usage before/after figure[ 5] =3D 77612 79952 2340
Memory usage before/after figure[ 6] =3D 79952 82824 2872
Memory usage before/after figure[ 7] =3D 82824 84656 1832
Memory usage before/after figure[ 8] =3D 84656 86784 2128
Memory usage before/after figure[ 9] =3D 86784 89312 2528

Showing 2 results of 2

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /