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

Showing 4 results of 4

From: Ray O. <RO...@an...> - 2012年03月24日 19:52:33
I have a colleague experiencing similar issues. There seem to be known issues with PySide 1.1.0, e.g.,
http://bugs.pyside.org/show_bug.cgi?id=1119
I tried overriding the call to QApplication.setOverrideCursor(), which customizes the cursor within the Matplotlib navigation toolbar, but he then encountered another Shiboken-related segfault. It has been very frustrating, so I would be interested if anyone has a solution before the PySide team issues another release.
Ray
On Mar 24, 2012, at 1:10 PM, Wes McKinney wrote:
> Has anyone had much luck with PySide + matplotlib 1.1.0+? With stock
> EPD 7.2 full on Ubuntu 10.04 which comes with PySide 1.1.0, a simple
> plot like plot(arange(10)) with IPython in pylab mode causes a
> segfault. Joy.
> 
> Thanks,
> Wes
> 
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here 
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Ray Osborn
Materials Science Division
Argonne National Laboratory
Argonne, IL 60439, USA
Phone: +1 (630) 252-9011
Email: RO...@an...
From: Wes M. <wes...@gm...> - 2012年03月24日 18:10:49
Has anyone had much luck with PySide + matplotlib 1.1.0+? With stock
EPD 7.2 full on Ubuntu 10.04 which comes with PySide 1.1.0, a simple
plot like plot(arange(10)) with IPython in pylab mode causes a
segfault. Joy.
Thanks,
Wes
From: David V. <dav...@gm...> - 2012年03月24日 10:59:38
A while ago I had exactly the same problem. I was running a script that 
create a lot of figures and saved them (as .png and .eps files) for 
viewing later (so not using the interactive viewing feature from 
pyplot). If I remember well, there was also a problem with the close() 
statement leaving some stuff in memory. Unfortunately I don't remember 
how the details went and how it got fixed. I guess I should have used 
the mailing list or created a bug report.
Anyway, when I need to generate a massive amount of figures these days I 
bypass the pyplot interface completely and go straight for the 
matplotlib API (at least as far as I understand this approach myself). 
When using pyplot, some figure tweaks did not persist upon saving, but 
that might as well have been due to my limited matplotlib knowledge. The 
procedure was inspired by this blog post: 
http://sjohannes.wordpress.com/2010/06/11/using-matplotlib-in-a-web-application/ 
and goes as follows:
from matplotlib.figure import Figure
# dependent on the backend you use
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as 
FigCanvas
# set figure size, dpi and initiate a workable fig object
fig = Figure(figsize=(figsize_x, figsize_y), dpi=dpi)
canvas = FigCanvas(fig)
fig.set_canvas(canvas)
# tweak white spacings
fig.subplots_adjust(left=wsleft, bottom=wsbottom, right=wsright,
top=wstop, wspace=wspace, hspace=hspace)
# big main title
fig.suptitle(grandtitle, size='x-large')
# create a subplot
ax = fig.add_subplot(nr_rows, nr_cols, plot_nr)
# do all your plotting stuff here on ax
# save the figure and close
fig.savefig('/path/to/figure/figname.png')
canvas.close()
fig.clear()
If interested, I can give you a more elaborate and working example of 
which parameters I tune how exactly.
Regards,
David
On 23/03/12 19:45, Eric Firing wrote:
> On 03/23/2012 08:05 AM, Albert Kottke wrote:
>> I am having problems clearing figures from memory. After saving the
>> figure, I use pyplot.close() on the figure handle and then del all of
>> the data and figure, as shown here:
>>
>> fig.savefig('plots/%(record_id)05i' % recording)
>> plt.close(fig)
>>
>> del accel, fourier_amp, fig, time, disp
>> gc.collect()
>>
>> Despite this, the figures don't appear to be closing. I am trying to
>> make 30k plots and I have to kill script every couple thousand and
>> restart because I run out of memory.
>>
>> Any suggestions?
> You are running a standalone script, correct? Make sure you are using
> only the agg backend. Before the first import of pyplot, do
>
> import matplotlib
> matplotlib.use("agg")
>
> I don't know if that will help, but it can't hurt.
>
> You might find matplotlib.cbook.report_memory() to be useful in tracking
> down the problem.
>
> Eric
>
>>
>> Albert
>>
>> ------------------------------------------------------------------------------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: John H. <jd...@gm...> - 2012年03月24日 03:49:24
On Fri, Mar 23, 2012 at 3:35 PM, Andrew Smart <and...@gm...>wrote:
> Hi,
> I'm running into this RuntimeError: Could not open facefile
> c:\Python32\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
> Cannot_Open_Resource when I'm trying to save out a series of *.png files in
> a loop. It crashes on this error after many passes through the loop and
> successful files get created, but then always on the same pass it does
> this. The full traceback is here:
>
> I wonder if the solution is as simple as doing font caching at the class
level rather than instance level. Andrew, could you try editing
matplotlib/backends/backend_agg.py and replace
class RendererAgg(RendererBase):
 """
 The renderer handles all the drawing primitives using a graphics
 context instance that controls the colors/styles
 """
 debug=1
 def __init__(self, width, height, dpi):
 if __debug__: verbose.report('RendererAgg.__init__',
'debug-annoying')
 RendererBase.__init__(self)
 self.texd = maxdict(50) # a cache of tex image rasters
 self._fontd = maxdict(50)
with
class RendererAgg(RendererBase):
 """
 The renderer handles all the drawing primitives using a graphics
 context instance that controls the colors/styles
 """
 debug=1
 _fontd = maxdict(50)
 texd = maxdict(50) # a cache of tex image rasters
 def __init__(self, width, height, dpi):
 if __debug__: verbose.report('RendererAgg.__init__',
'debug-annoying')
 RendererBase.__init__(self)
Does anyone see an issue with doing this caching at the class level? If
this works, we should have *many* fewer font files parsed.
w/o modifying the src code, a related way to test this idea is to reuse the
same figure instance and clear it at the start of the loop. Ie, rather than
for i in range(N):
 fig = plt.figure()
 ....plot_something
 fig.savefig(...)
do
fig = plt.figure()
for i in range(N):
 fig.clf()
 ....plot_something
 fig.savefig(...)
I would try the latter first, and if that works I would appreciate it if
you test the src code modification unless someone chimes in and tells us
that is a really bad idea.
JDH

Showing 4 results of 4

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 によって変換されたページ (->オリジナル) /