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
(22) |
2
(17) |
3
(21) |
4
(7) |
5
(7) |
6
(17) |
7
(8) |
8
(8) |
9
(33) |
10
(11) |
11
|
12
(2) |
13
(11) |
14
(29) |
15
(13) |
16
(13) |
17
(3) |
18
(2) |
19
(3) |
20
(7) |
21
(17) |
22
(12) |
23
(19) |
24
(19) |
25
(14) |
26
(5) |
27
(25) |
28
(13) |
|
|
|
|
Hi to all! A short question. How can I do to remove a line from a subplot? I use add_line(...) in order to add it, but what command have I to use for remove it? Thanks. Luigi
Dear John, I finnaly found a solution that works following the suggestion from Charl= ie Moad (many thanks !). Before this, I tried what you suggested (explicitly naming the figure). T= he output for 3 cycles is shown bellow in result1. It doesn't change much in= the story, the memory still increases by about 6Mb. I also show the result wh= en I uncomment the savefig line (result2) which also shows an increase by abou= t 0.6 Mb. If instead of actually closing and opening a figure each time I use gcf (= without closing the figure), then, if works fine (result3). Unlike for the first = two cases, the memory is freed using the gc.collector (instead of close). The final code is at the bottom. I still don't uderstand why it doesn't w= ork by the first method, but at least it works... Many thanks, Cheers, Aur=E9lien -------------- RESULT 1: memory used 331.55 Mb Building individual images... building file ... memory used for image - step1 331.55 Mb memory used for image - step2 331.55 Mb memory used for image - step3 331.55 Mb memory used for image - step4 331.55 Mb -> created fig memory used for image - step5 331.55 Mb -> cleared fig memory used for image - step6 329.11 Mb -> built image - imshow memory used for image - step7 329.20 Mb -> added colorbar memory used for image - step8 329.20 Mb -> turned axis off memory used for image - step9 336.74 Mb -> saved fig memory used for image - step10 336.74 Mb -> cleared cached text memory used for image - step11 336.74 Mb -> cleared image (axes) memory used for image - step12 336.74 Mb memory used for image - step13 328.31 Mb -> closed figure memory used for image - step14 328.31 Mb -> called garbage collector total time =3D 1.84299993515 done memory used 328.31 Mb building file ... memory used for image - step1 328.31 Mb memory used for image - step2 328.31 Mb memory used for image - step3 328.31 Mb memory used for image - step4 342.26 Mb -> created fig memory used for image - step5 342.26 Mb -> cleared fig memory used for image - step6 339.84 Mb -> built image - imshow memory used for image - step7 339.94 Mb -> added colorbar memory used for image - step8 339.94 Mb -> turned axis off memory used for image - step9 347.50 Mb -> saved fig memory used for image - step10 347.50 Mb -> cleared cached text memory used for image - step11 347.50 Mb -> cleared image (axes) memory used for image - step12 347.50 Mb memory used for image - step13 333.66 Mb -> closed figure memory used for image - step14 333.66 Mb -> called garbage collector total time =3D 1.93700003624 done memory used 333.66 Mb building file ... memory used for image - step1 333.66 Mb memory used for image - step2 333.66 Mb memory used for image - step3 333.66 Mb memory used for image - step4 347.81 Mb -> created fig memory used for image - step5 347.81 Mb -> cleared fig memory used for image - step6 345.40 Mb -> built image - imshow memory used for image - step7 345.51 Mb -> added colorbar memory used for image - step8 345.51 Mb -> turned axis off memory used for image - step9 353.57 Mb -> saved fig memory used for image - step10 353.57 Mb -> cleared cached text memory used for image - step11 353.57 Mb -> cleared image (axes) memory used for image - step12 353.57 Mb memory used for image - step13 339.73 Mb -> closed figure memory used for image - step14 339.73 Mb -> called garbage collector total time =3D 1.67200016975 done -- RESULT 2: memory used 345.79 Mb Building individual images... building file=20 I:/EggShell/ESRF-sc1579-201104/OriginalDataPolarTransform/egg4_8_0500_pol= ar_mask.png ... memory used for image - step1 345.79 Mb memory used for image - step2 345.79 Mb memory used for image - step3 345.79 Mb memory used for image - step4 359.92 Mb -> created fig memory used for image - step5 359.92 Mb -> cleared fig memory used for image - step6 357.51 Mb -> built image - imshow memory used for image - step7 357.61 Mb -> added colorbar memory used for image - step8 357.61 Mb -> turned axis off memory used for image - step9 357.61 Mb -> saved fig - DISABLED memory used for image - step10 357.61 Mb -> cleared cached text memory used for image - step11 357.61 Mb -> cleared image (axes) memory used for image - step12 357.61 Mb memory used for image - step13 343.77 Mb -> closed figure memory used for image - step14 343.77 Mb -> called garbage collector total time =3D 1.25 done memory used 343.77 Mb building file=20 I:/EggShell/ESRF-sc1579-201104/OriginalDataPolarTransform/egg4_8_0499_pol= ar_mask.png ... memory used for image - step1 343.77 Mb memory used for image - step2 343.77 Mb memory used for image - step3 344.02 Mb memory used for image - step4 358.22 Mb -> created fig memory used for image - step5 358.22 Mb -> cleared fig memory used for image - step6 358.28 Mb -> built image - imshow memory used for image - step7 358.38 Mb -> added colorbar memory used for image - step8 358.38 Mb -> turned axis off memory used for image - step9 358.38 Mb -> saved fig - DISABLED memory used for image - step10 358.38 Mb -> cleared cached text memory used for image - step11 358.38 Mb -> cleared image (axes) memory used for image - step12 358.38 Mb memory used for image - step13 344.54 Mb -> closed figure memory used for image - step14 344.54 Mb -> called garbage collector total time =3D 0.625 done memory used 344.54 Mb building file=20 I:/EggShell/ESRF-sc1579-201104/OriginalDataPolarTransform/egg4_8_0498_pol= ar_mask.png ... memory used for image - step1 344.54 Mb memory used for image - step2 344.54 Mb memory used for image - step3 344.54 Mb memory used for image - step4 358.74 Mb -> created fig memory used for image - step5 358.75 Mb -> cleared fig memory used for image - step6 358.81 Mb -> built image - imshow memory used for image - step7 358.91 Mb -> added colorbar memory used for image - step8 358.91 Mb -> turned axis off memory used for image - step9 358.91 Mb -> saved fig - DISABLED memory used for image - step10 358.91 Mb -> cleared cached text memory used for image - step11 358.91 Mb -> cleared image (axes) memory used for image - step12 358.91 Mb memory used for image - step13 345.06 Mb -> closed figure memory used for image - step14 345.06 Mb -> called garbage collector total time =3D 0.640000104904 done -- RESULT 3: memory used 325.69 Mb Building individual images... building file ... memory used for image - step1 325.69 Mb memory used for image - step2 325.41 Mb memory used for image - step3 325.41 Mb memory used for image - step4 325.41 Mb -> created fig - gcf memory used for image - step5 325.41 Mb -> cleared fig memory used for image - step6 322.70 Mb -> built image - imshow memory used for image - step7 322.61 Mb -> added colorbar memory used for image - step8 322.61 Mb -> turned axis off memory used for image - step9 330.62 Mb -> saved fig memory used for image - step10 330.62 Mb -> cleared cached text memory used for image - step11 330.62 Mb -> cleared image (axes) memory used for image - step12 330.62 Mb memory used for image - step13 330.62 Mb -> closed figure - DISABLED memory used for image - step14 325.12 Mb -> called garbage collector total time =3D 1.28099989891 done memory used 325.12 Mb building file ... memory used for image - step1 325.12 Mb memory used for image - step2 325.12 Mb memory used for image - step3 325.12 Mb memory used for image - step4 325.12 Mb -> created fig - gcf memory used for image - step5 325.12 Mb -> cleared fig memory used for image - step6 322.65 Mb -> built image - imshow memory used for image - step7 322.65 Mb -> added colorbar memory used for image - step8 322.65 Mb -> turned axis off memory used for image - step9 330.63 Mb -> saved fig memory used for image - step10 330.63 Mb -> cleared cached text memory used for image - step11 330.63 Mb -> cleared image (axes) memory used for image - step12 330.63 Mb memory used for image - step13 330.63 Mb -> closed figure - DISABLED memory used for image - step14 325.13 Mb -> called garbage collector total time =3D 1.31299996376 done memory used 325.13 Mb building file ... memory used for image - step1 325.13 Mb memory used for image - step2 325.13 Mb memory used for image - step3 325.13 Mb memory used for image - step4 325.13 Mb -> created fig - gcf memory used for image - step5 325.13 Mb -> cleared fig memory used for image - step6 322.62 Mb -> built image - imshow memory used for image - step7 322.63 Mb -> added colorbar memory used for image - step8 322.63 Mb -> turned axis off memory used for image - step9 330.64 Mb -> saved fig memory used for image - step10 330.64 Mb -> cleared cached text memory used for image - step11 330.64 Mb -> cleared image (axes) memory used for image - step12 330.64 Mb memory used for image - step13 330.64 Mb -> closed figure - DISABLED memory used for image - step14 325.09 Mb -> called garbage collector total time =3D 1.31299996376 done -- def generateImshow(yarray, xscansize,yscansize, xscanstep,yscanstep, outputfilename, initimagesize =3D 10): '''Use this function to generate matplotlib images without displaying them''' # val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step1 ','%.2f' % val,' Mb' #reshape according to scan yarray =3D na.reshape(yarray,(yscansize,-1)) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step2 ','%.2f' % val,' Mb' #build image via matplotlib ximagesize =3D xscansize*xscanstep yimagesize =3D yscansize*yscanstep xyimageratio =3D float(ximagesize)/yimagesize #print xyimageratio if xyimageratio > 1: ximagesize,yimagesize =3D initimagesize,initimagesize*xyimageratio else: ximagesize,yimagesize =3D initimagesize*xyimageratio,initimages= ize val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step3 ','%.2f' % val,' Mb' #fig1 =3D pylab.figure(figsize=3D(ximagesize,yimagesize),dpi=3D100) #fig1 =3D pylab.figure(1,figsize=3D(ximagesize,yimagesize),dpi=3D100) fig1 =3D pylab.gcf() fig1.set_figsize_inches((ximagesize,yimagesize)) fig1.set_dpi(100) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step4 ','%.2f' % val,' Mb' fig1.clear() val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step5 ','%.2f' % val,' Mb' #pylab.title('blahblah') im1 =3D pylab.imshow(yarray, origin=3D'lower', #interpolation=3D'nearest', #i.e. pixel interpolation=3D'bicubic', #i.e. smooth #vmin=3Dminvalue, #vmax=3Dmaxvalue, cmap =3D pylab.cm.bone, ) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step6 ','%.2f' % val,' Mb' colbar1 =3D pylab.colorbar() val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step7 ','%.2f' % val,' Mb' #pylab.bone() pylab.axis('off') val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step8 ','%.2f' % val,' Mb' #save figure pylab.savefig(outputfilename) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step9 ','%.2f' % val,' Mb' mpl.text.Text.cached =3D {} val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step10 ','%.2f' % val,' Mb' pylab.cla() val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step11 ','%.2f' % val,' Mb' del im1,colbar1 #doesn't bring anything val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step12 ','%.2f' % val,' Mb' #pylab.close(fig1) #pylab.close(1) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step13 ','%.2f' % val,' Mb' #pylab.close('all') gc.collect() val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step14 ','%.2f' % val,' Mb' ------------------------- Selon John Hunter <jdh...@ac...>: > >>>>> "aurelien" =3D=3D aurelien gourrier <aur...@fr...> w= rites: > > aurelien> Dear all, I posted a message two days ago mentionning > aurelien> memory problems while saving a large number of images, > aurelien> which I guess was not so clear... I've worked a bit on > aurelien> it and I think the questions seem clearer to me now. I > aurelien> have paid particular attention to the threads in the > aurelien> user mailing list dealing with memory problems. > > What happens if you explicitly name the figure (ef figure(1)) > > for i in range(indEnd): > > figure(1) > subplot(221) > plot(ind, xx) > > subplot(222) > X =3D rand(50,50) > > imshow(X) > subplot(223) > scatter(rand(50), rand(50)) > subplot(224) > pcolor(10*rand(50,50)) > > savefig('tmp%d' % i, dpi =3D 75) > close(1) > > See also the FAQ http://matplotlib.sourceforge.net/faq.html#LEAKS > which shows the canonical way to make multiple plots to prevent leaks, > namely, pairing a close with each figure creation? > > I'm not sure why you are seeing a problem right now, but my memory > leak test script memleak_hawaii3.py does not appear to be leaking > > #!/usr/bin/env python > > import os, sys, time > import matplotlib > #matplotlib.interactive(True) > #matplotlib.use('Cairo') > matplotlib.use('Agg') > from pylab import * > > > def report_memory(i): > pid =3D os.getpid() > a2 =3D os.popen('ps -p %d -o rss,sz' % pid).readlines() > print i, ' ', a2[1], > return int(a2[1].split()[1]) > > > > # take a memory snapshot on indStart and compare it with indEnd > > indStart, indEnd =3D 30, 201 > for i in range(indEnd): > > figure(1); clf() > > subplot(221) > t1 =3D arange(0.0, 2.0, 0.01) > y =3D sin(2*pi*t1) > plot(t1,y,'-') > plot(t1, rand(len(t1)), 's', hold=3DTrue) > > > subplot(222) > X =3D rand(50,50) > > imshow(X) > subplot(223) > scatter(rand(50), rand(50), s=3D100*rand(50), c=3Drand(50)) > subplot(224) > pcolor(10*rand(50,50)) > savefig('tmp%d' % i, dpi =3D 75) > close(1) > > val =3D report_memory(i) > if i=3D=3DindStart: start =3D val # wait a few cycles for memory us= age to > stabilize > > end =3D val > print 'Average memory consumed per loop: %1.4fk bytes\n' % > ((end-start)/float(indEnd-indStart)) > >
thanks Charlie, I'm using darwinports/python24 whereas the preinstalled environment which includes wxpython is python23. I have only been able to find a scipy egg for python24, so at the moment, I am going to use scipy/numpy with matplotlib/Numeric. I'll wait until matplotlib/numpy makes it into darwinports. I'm not particularly wedded to the idea of using py-gtk2, is there any compelling reason to use wxpython over py-gtk2? regards, Graeme On 10/02/2006, at 11:10 PM, Charlie Moad wrote: > Wxpython comes preinstalled on 10.4 as does Tkinter. I am pretty > sure that the eggs that Chris has posted in addition to mine link > against those. You would probably need a custom build for > darwinports to play nice. I can't test any of this, so I may not be > much more help. Also, I have never tried gtkagg on osx since there is > no native gtk2 toolkit. I am sure it would work fine with > fink/darwinports gtk2 though under X11.app. > > On 2/9/06, Graeme O'Keefe <gra...@pe...> wrote: >> Hi Charlie, >> >> I'm a bit new to the whole 'egg' thing. >> >> I retrieved the egg from Chris Fonnesbeck's homepage: >> http://homepage.mac.com/fonnesbeck/mac/ >> >> Anyway, the matplotlib data files issue is resolved, I have a copy of >> mpl-data in my ~/.matplotlib directory now. It is picked up as >> default. >> >> I tried your egg, unfortunately, I've not been able to get wxWindows >> installed via darwinports. >> I tried TkAgg, problems as well (libJPEG conflict), so I look to have >> a stuffed setup from darwinports. >> >> Do you have a GTKAgg backend you could add the egg? >> >> regards, >> >> Graeme >> >> On 09/02/2006, at 11:14 PM, Charlie Moad wrote: >> >>> On 2/8/06, Graeme O'Keefe <gra...@pe...> >>> wrote: >>>> I'm trying to migrate from numarray to numpy. >>>> >>>> By and large it is reasonably painless, substituting itemsize for >>>> itemsize() >>>> and numarray.mlab.squeeze/tri with numpy.squeeze/tri are all I have >>>> encountered so far. >>>> >>>> However, I have not been able to get the numpy distribution of >>>> matplotlib >>>> working on OS-X >>>> >>>> The matplotlib egg is installed to: >>>> /Library/Frameworks/Python.framework/Versions/Current/lib/ >>>> python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4- >>>> ppc.egg >>>> where I also have installed: >>>> numarray-1.5.1-py2.4-macosx-10.4-ppc.egg >>>> numpy-0.9.5.2053-py2.4-macosx-10.4-ppc.egg >>>> scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg >>>> >>>> >>>> then >>>> % python >>>>>>> import pylab >>>> Traceback (most recent call last): >>>> File "<stdin>", line 1, in ? >>>> File >>>> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ >>>> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ >>>> pylab.py", >>>> line 1, in ? >>>> from matplotlib.pylab import * >>>> File >>>> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ >>>> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ >>>> matplotlib/__init__.py", >>>> line 744, in ? >>>> defaultParams = { >>>> File >>>> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ >>>> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ >>>> matplotlib/__init__.py", >>>> line 273, in wrapper >>>> ret = func(*args, **kwargs) >>>> File >>>> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ >>>> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ >>>> matplotlib/__init__.py", >>>> line 434, in _get_data_path >>>> raise RuntimeError('Could not find the matplotlib data files') >>>> RuntimeError: Could not find the matplotlib data files >>>> >>>> BTW, are there eggs for freetype/py-gtk etc. I've been using >>>> darwinports >>>> till now. >>> >>> Did you build and install the egg yourself, or did you download it >>> from somewhere? Freetype won't have an egg since it is not a python >>> library. In my tests I was able to add libpng and libfreetype >>> static >>> libraries to the matplotlib egg and it worked fine. If you want, >>> you >>> can try eggs I have posted for 0.86: >>> http://euclid.uits.iupui.edu/~cmoad/mpleggs/ . The matplotlib >>> one has >>> the static libs added, so I would be interested to know if it works >>> for you. I can update these as well if you would like. >>> >>> - Charlie >>> >> >> >
Potential testers: CVS mpl now has a new demo (examples/collections.py) that illustrates two minor new capabilities: 1) The axes.add_collection() method accepts a new boolean kwarg, "autolim"; if True, then a subsequent call to axes.autoscale_view will take into account the data in the collection. 2) LineCollection can now be called with kwargs "offsets=(xo,yo), transOffset=None" to facilitate making waterfall plots or stagger plots--that is, a set of sequentially offset curves. The demo may also be useful in illustrating some basic ways of using line and polygon collections; this is not entirely obvious from the docstrings. (I have tried to improve some of the docstrings also.) The changes were prompted by Chris Barker's earlier message with a demo script, which showed me how to use the two transforms involved in these types of collections. Eric
Charlie Moad <cwmoad@...> writes: > > I just committed the changes to cvs and added a convenience function > for py2exe called get_py2exe_datafiles. Charlie and John, John, in answer to your question, yes, I was using the py2exe examples from the FAQ page. Charlie, I'll try out the convenience function you created and report back with my findings. Hopefully this will be of use to other users who have the same file structure as I do. With Thanks, Daniel Oakland, CA www.bluepattern.com
I just committed to cvs an extensive cleanup of the usetex code in the postscript backend. In the process, I think I resolved the clipping problem people were reporting with ghostscript-7.07. Things look good on my machine, at least. I've tested every combination of the postscript backend with and without usetex, with all three distiller options (None, ghostscript, and xpdf), and didnt find any problems. But if a problem turns up, please let me know. Darren
Hello NG, I have a couple of questions regardin a simple app that I have created, which uses wxPython + mpl. Basically the problem is as follows: - The user can plot a certain property (let's say velocity) versus time; the time variable can be a floating number, but it can also be displayed as a date. As long as the time variable is a float and I don't have more than 2 subplots for every "row" of subplots, everything seems good. But, if I use "date" as X-variable and I have 2 or more subplots in one row, there is no more room for all the ticks in one subplot to be displayed correctly (they overlap one over the other, is a mess). - The option of using rotated ticks is nice as long as I have only 1 subplot. For more subplots, it looks messy. - After the user has finished the plot formatting, I create a series of figures (they are the same as for the layout, but they contain different data) and I embed them in MS Word or Powerpoint using win32com. Now, the questions: 1) Based on subplot size (and I don't know how to retrieve a single subplot size in inches or pixels or whatever), is there a way to calculate the "best" number of X-ticks that can fit into the X-axis without overlapping? I am thinking about binding a wx.EVT_SIZE for the displayed figure, but obviously this will not work for the saved figures (I use Agg to save figures); 2) I have a time interval on the X-axis. If the time interval spans about 5-6 years, I would like to tick every year (say every January, 1) the X-axis as long as there is enough room to tick them; if there is not enough space, I would like to tick once every 2 years and put a minor tick between the major ticks. 3) When I use 2 Y-axes (as in two_scales.py) the "auto" legend location does not consider data on the second axis when it calculates the best legend position. So I end up with a legend that "stays away" from lines that belongs on first Y-axis but it overlaps the lines plotted on the second Y-axis; 4) Does anyone know if there is an easy way to fix the two_scales problem mentioned in a previous thread: http://sourceforge.net/mailarchive/forum.php?thread_id=9639992&forum_id=33405 ? Thank you very much for every idea/suggestion. Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://xoomer.virgilio.it/infinity77
>>>>> "aurelien" == aurelien gourrier <aur...@fr...> writes: aurelien> Dear all, I posted a message two days ago mentionning aurelien> memory problems while saving a large number of images, aurelien> which I guess was not so clear... I've worked a bit on aurelien> it and I think the questions seem clearer to me now. I aurelien> have paid particular attention to the threads in the aurelien> user mailing list dealing with memory problems. What happens if you explicitly name the figure (ef figure(1)) for i in range(indEnd): figure(1) subplot(221) plot(ind, xx) subplot(222) X = rand(50,50) imshow(X) subplot(223) scatter(rand(50), rand(50)) subplot(224) pcolor(10*rand(50,50)) savefig('tmp%d' % i, dpi = 75) close(1) See also the FAQ http://matplotlib.sourceforge.net/faq.html#LEAKS which shows the canonical way to make multiple plots to prevent leaks, namely, pairing a close with each figure creation? I'm not sure why you are seeing a problem right now, but my memory leak test script memleak_hawaii3.py does not appear to be leaking #!/usr/bin/env python import os, sys, time import matplotlib #matplotlib.interactive(True) #matplotlib.use('Cairo') matplotlib.use('Agg') from pylab import * def report_memory(i): pid = os.getpid() a2 = os.popen('ps -p %d -o rss,sz' % pid).readlines() print i, ' ', a2[1], return int(a2[1].split()[1]) # take a memory snapshot on indStart and compare it with indEnd indStart, indEnd = 30, 201 for i in range(indEnd): figure(1); clf() subplot(221) t1 = arange(0.0, 2.0, 0.01) y = sin(2*pi*t1) plot(t1,y,'-') plot(t1, rand(len(t1)), 's', hold=True) subplot(222) X = rand(50,50) imshow(X) subplot(223) scatter(rand(50), rand(50), s=100*rand(50), c=rand(50)) subplot(224) pcolor(10*rand(50,50)) savefig('tmp%d' % i, dpi = 75) close(1) val = report_memory(i) if i==indStart: start = val # wait a few cycles for memory usage to stabilize end = val print 'Average memory consumed per loop: %1.4fk bytes\n' % ((end-start)/float(indEnd-indStart))
Hi Nils, On Friday 10 February 2006 09:29, Nils Wagner wrote: > Hi all, > > When importing matplotlib I get > > >>> import matplotlib > > /usr/lib64/python2.4/site-packages/matplotlib/__init__.py:924: > UserWarning: Bad val "medium" on line #112 > "font.size : medium" > in file "/home/nwagner/.matplotlib/matplotlibrc" > Could not convert "medium" to float > warnings.warn('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % > ( > > I guess I should remove the line containing > > font.size : medium > > from my matplotlibrc. Is that correct ? I posted to matplotlib-users warning about this change just last night: http://sourceforge.net/mailarchive/forum.php?thread_id=9687650&forum_id=33405, and I posted a note in the CHANGELOG. Just set font.size : 12.0. Darren
Hi all, When importing matplotlib I get >>> import matplotlib /usr/lib64/python2.4/site-packages/matplotlib/__init__.py:924: UserWarning: Bad val "medium" on line #112 "font.size : medium" in file "/home/nwagner/.matplotlib/matplotlibrc" Could not convert "medium" to float warnings.warn('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % ( I guess I should remove the line containing font.size : medium from my matplotlibrc. Is that correct ? Nils
Just a quick suggestion. Since you are using pylab and you don't really show a need to recreate a figure everytime, just use "fig1 =3D pylab.gcf()" and don't delete it at the end. Reusing current memory is always going to help prevent leaks. On 2/10/06, aur...@fr... <aur...@fr...> wrote: > Dear all, > > I posted a message two days ago mentionning memory problems while saving = a large > number of images, which I guess was not so clear... I've worked a bit on = it and > I think the questions seem clearer to me now. I have paid particular atte= ntion > to the threads in the user mailing list dealing with memory problems. > > I use a function that generates arrays of typically 500x1380 elements. > For each column, I transform the data and image them using imshow. I need= n't > display them, all I do is save them. I therefore wrote a function > generateImshow which I show below. > > This function allows to produce about 300 out of 500 images and then cras= hes. I > therefore output the memory usage at each step. I run this from a pyWin s= hell > on windows XP using a 2.8GHz processor with 512 Kb memory. The result is = shown > below. The conclusions are the following : > > - each cycle leads to an increase of about 6Mb in memory usage, which exp= lains > why it crashes after some cycles > > - if I comment the line pylab.savefig(), then I only get an overall incre= ase of > about 0.6 Mb, which is a lot, but I can live with this > > - obviously, clf() does a good job in freeing memory, but calling the gar= bage > collector gc.collector does not help, nor does clearing the cached text a= s > suggested in one of the mails > > The problem clearly seems to originate from the savefig operation but I c= an't > figure out what's going on... anyone has a clue or an idea of how to over= come > the problem ? > > Cheers, > > Aur=E9lien > > > ---- > def generateImshow(yarray, > xscansize,yscansize, > xscanstep,yscanstep, > outputfilename, > initimagesize =3D 10): > '''Use this function to generate matplotlib images without displaying > them''' > > # > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step1 ','%.2f' % val,' Mb\n' > > ##normalize file containing intensity correction factors > #xlist, ylist =3D fileHandling(filename).readChi() > ##fill in missing data if any > #ylist.extend([0]*(scanx*scany-len(ylist))) > #reshape according to scan > yarray =3D na.reshape(yarray,(yscansize,-1)) > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step2 ','%.2f' % val,' Mb' > > #build image via matplotlib > ximagesize =3D xscansize*xscanstep > yimagesize =3D yscansize*yscanstep > xyimageratio =3D float(ximagesize)/yimagesize > #print xyimageratio > if xyimageratio > 1: ximagesize,yimagesize =3D > initimagesize,initimagesize*xyimageratio > else: ximagesize,yimagesize =3D initimagesize*xyimageratio,initimages= ize > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step3 ','%.2f' % val,' Mb' > > fig1 =3D pylab.figure(figsize=3D(ximagesize,yimagesize),dpi=3D100) > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step4 ','%.2f' % val,' Mb' > > fig1.clear() > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step5 ','%.2f' % val,' Mb' > > > #pylab.title('blahblah') > im1 =3D pylab.imshow(yarray, > origin=3D'lower', > #interpolation=3D'nearest', #i.e. pixel > interpolation=3D'bicubic', #i.e. smooth > #vmin=3Dminvalue, > #vmax=3Dmaxvalue, > cmap =3D pylab.cm.bone, > ) > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step6 ','%.2f' % val,' Mb' > > colbar1 =3D pylab.colorbar() > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step7 ','%.2f' % val,' Mb' > > #pylab.bone() > pylab.axis('off') > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step8 ','%.2f' % val,' Mb' > > #save figure > #outputfilename =3D filename[:-4]+'.png' > pylab.savefig(outputfilename) > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step9 ','%.2f' % val,' Mb' > > mpl.text.Text.cached =3D {} > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step10 ','%.2f' % val,' Mb' > > pylab.cla() > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step11 ','%.2f' % val,' Mb' > > del im1,colbar1 #doesn't bring anything > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step12 ','%.2f' % val,' Mb' > > pylab.close(fig1) > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step13 ','%.2f' % val,' Mb' > > #pylab.close('all') > gc.collect() > > val =3D float(getMemoryUsage())/1000000 > print 'memory used for image - step14 ','%.2f' % val,' Mb' > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Result for three steps : > > memory used for image - step1 296.57 Mb > memory used for image - step2 296.57 Mb > memory used for image - step3 296.57 Mb > memory used for image - step4 310.75 Mb > memory used for image - step5 310.75 Mb > memory used for image - step6 308.61 Mb > memory used for image - step7 308.71 Mb > memory used for image - step8 308.71 Mb > memory used for image - step9 316.77 Mb > memory used for image - step10 316.77 Mb > memory used for image - step11 316.77 Mb > memory used for image - step12 316.77 Mb > memory used for image - step13 302.92 Mb > memory used for image - step14 302.92 Mb > total time =3D 1.64100003242 > done > memory used 302.92 Mb > building file ... > > memory used for image - step1 302.92 Mb > memory used for image - step2 302.92 Mb > memory used for image - step3 302.92 Mb > memory used for image - step4 317.10 Mb > memory used for image - step5 317.10 Mb > memory used for image - step6 314.70 Mb > memory used for image - step7 314.80 Mb > memory used for image - step8 314.80 Mb > memory used for image - step9 322.87 Mb > memory used for image - step10 322.87 Mb > memory used for image - step11 322.87 Mb > memory used for image - step12 322.87 Mb > memory used for image - step13 309.02 Mb > memory used for image - step14 309.02 Mb > total time =3D 1.65599989891 > done > memory used 309.02 Mb > building file ... > > memory used for image - step1 309.02 Mb > memory used for image - step2 309.02 Mb > memory used for image - step3 309.02 Mb > memory used for image - step4 323.20 Mb > memory used for image - step5 323.20 Mb > memory used for image - step6 320.79 Mb > memory used for image - step7 320.90 Mb > memory used for image - step8 320.90 Mb > memory used for image - step9 328.97 Mb > memory used for image - step10 328.99 Mb > memory used for image - step11 328.98 Mb > memory used for image - step12 328.98 Mb > memory used for image - step13 315.14 Mb > memory used for image - step14 315.14 Mb > total time =3D 1.875 > done > > -- > Just Aur=E9 > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmdlnk&kid=103432&bid#0486&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Dear all, I posted a message two days ago mentionning memory problems while saving = a large number of images, which I guess was not so clear... I've worked a bit on = it and I think the questions seem clearer to me now. I have paid particular atte= ntion to the threads in the user mailing list dealing with memory problems. I use a function that generates arrays of typically 500x1380 elements. For each column, I transform the data and image them using imshow. I need= n't display them, all I do is save them. I therefore wrote a function generateImshow which I show below. This function allows to produce about 300 out of 500 images and then cras= hes. I therefore output the memory usage at each step. I run this from a pyWin s= hell on windows XP using a 2.8GHz processor with 512 Kb memory. The result is = shown below. The conclusions are the following : - each cycle leads to an increase of about 6Mb in memory usage, which exp= lains why it crashes after some cycles - if I comment the line pylab.savefig(), then I only get an overall incre= ase of about 0.6 Mb, which is a lot, but I can live with this - obviously, clf() does a good job in freeing memory, but calling the gar= bage collector gc.collector does not help, nor does clearing the cached text a= s suggested in one of the mails The problem clearly seems to originate from the savefig operation but I c= an't figure out what's going on... anyone has a clue or an idea of how to over= come the problem ? Cheers, Aur=E9lien ---- def generateImshow(yarray, xscansize,yscansize, xscanstep,yscanstep, outputfilename, initimagesize =3D 10): '''Use this function to generate matplotlib images without displaying them''' # val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step1 ','%.2f' % val,' Mb\n' ##normalize file containing intensity correction factors #xlist, ylist =3D fileHandling(filename).readChi() ##fill in missing data if any #ylist.extend([0]*(scanx*scany-len(ylist))) #reshape according to scan yarray =3D na.reshape(yarray,(yscansize,-1)) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step2 ','%.2f' % val,' Mb' #build image via matplotlib ximagesize =3D xscansize*xscanstep yimagesize =3D yscansize*yscanstep xyimageratio =3D float(ximagesize)/yimagesize #print xyimageratio if xyimageratio > 1: ximagesize,yimagesize =3D initimagesize,initimagesize*xyimageratio else: ximagesize,yimagesize =3D initimagesize*xyimageratio,initimages= ize val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step3 ','%.2f' % val,' Mb' fig1 =3D pylab.figure(figsize=3D(ximagesize,yimagesize),dpi=3D100) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step4 ','%.2f' % val,' Mb' fig1.clear() val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step5 ','%.2f' % val,' Mb' #pylab.title('blahblah') im1 =3D pylab.imshow(yarray, origin=3D'lower', #interpolation=3D'nearest', #i.e. pixel interpolation=3D'bicubic', #i.e. smooth #vmin=3Dminvalue, #vmax=3Dmaxvalue, cmap =3D pylab.cm.bone, ) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step6 ','%.2f' % val,' Mb' colbar1 =3D pylab.colorbar() val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step7 ','%.2f' % val,' Mb' #pylab.bone() pylab.axis('off') val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step8 ','%.2f' % val,' Mb' #save figure #outputfilename =3D filename[:-4]+'.png' pylab.savefig(outputfilename) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step9 ','%.2f' % val,' Mb' mpl.text.Text.cached =3D {} val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step10 ','%.2f' % val,' Mb' pylab.cla() val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step11 ','%.2f' % val,' Mb' del im1,colbar1 #doesn't bring anything val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step12 ','%.2f' % val,' Mb' pylab.close(fig1) val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step13 ','%.2f' % val,' Mb' #pylab.close('all') gc.collect() val =3D float(getMemoryUsage())/1000000 print 'memory used for image - step14 ','%.2f' % val,' Mb' =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Result for three steps : memory used for image - step1 296.57 Mb memory used for image - step2 296.57 Mb memory used for image - step3 296.57 Mb memory used for image - step4 310.75 Mb memory used for image - step5 310.75 Mb memory used for image - step6 308.61 Mb memory used for image - step7 308.71 Mb memory used for image - step8 308.71 Mb memory used for image - step9 316.77 Mb memory used for image - step10 316.77 Mb memory used for image - step11 316.77 Mb memory used for image - step12 316.77 Mb memory used for image - step13 302.92 Mb memory used for image - step14 302.92 Mb total time =3D 1.64100003242 done memory used 302.92 Mb building file ... memory used for image - step1 302.92 Mb memory used for image - step2 302.92 Mb memory used for image - step3 302.92 Mb memory used for image - step4 317.10 Mb memory used for image - step5 317.10 Mb memory used for image - step6 314.70 Mb memory used for image - step7 314.80 Mb memory used for image - step8 314.80 Mb memory used for image - step9 322.87 Mb memory used for image - step10 322.87 Mb memory used for image - step11 322.87 Mb memory used for image - step12 322.87 Mb memory used for image - step13 309.02 Mb memory used for image - step14 309.02 Mb total time =3D 1.65599989891 done memory used 309.02 Mb building file ... memory used for image - step1 309.02 Mb memory used for image - step2 309.02 Mb memory used for image - step3 309.02 Mb memory used for image - step4 323.20 Mb memory used for image - step5 323.20 Mb memory used for image - step6 320.79 Mb memory used for image - step7 320.90 Mb memory used for image - step8 320.90 Mb memory used for image - step9 328.97 Mb memory used for image - step10 328.99 Mb memory used for image - step11 328.98 Mb memory used for image - step12 328.98 Mb memory used for image - step13 315.14 Mb memory used for image - step14 315.14 Mb total time =3D 1.875 done -- Just Aur=E9
Wxpython comes preinstalled on 10.4 as does Tkinter. I am pretty sure that the eggs that Chris has posted in addition to mine link against those. You would probably need a custom build for darwinports to play nice. I can't test any of this, so I may not be much more help. Also, I have never tried gtkagg on osx since there is no native gtk2 toolkit. I am sure it would work fine with fink/darwinports gtk2 though under X11.app. On 2/9/06, Graeme O'Keefe <gra...@pe...> wrote: > Hi Charlie, > > I'm a bit new to the whole 'egg' thing. > > I retrieved the egg from Chris Fonnesbeck's homepage: > http://homepage.mac.com/fonnesbeck/mac/ > > Anyway, the matplotlib data files issue is resolved, I have a copy of > mpl-data in my ~/.matplotlib directory now. It is picked up as default. > > I tried your egg, unfortunately, I've not been able to get wxWindows > installed via darwinports. > I tried TkAgg, problems as well (libJPEG conflict), so I look to have > a stuffed setup from darwinports. > > Do you have a GTKAgg backend you could add the egg? > > regards, > > Graeme > > On 09/02/2006, at 11:14 PM, Charlie Moad wrote: > > > On 2/8/06, Graeme O'Keefe <gra...@pe...> wrote: > >> I'm trying to migrate from numarray to numpy. > >> > >> By and large it is reasonably painless, substituting itemsize for > >> itemsize() > >> and numarray.mlab.squeeze/tri with numpy.squeeze/tri are all I have > >> encountered so far. > >> > >> However, I have not been able to get the numpy distribution of > >> matplotlib > >> working on OS-X > >> > >> The matplotlib egg is installed to: > >> /Library/Frameworks/Python.framework/Versions/Current/lib/ > >> python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4- > >> ppc.egg > >> where I also have installed: > >> numarray-1.5.1-py2.4-macosx-10.4-ppc.egg > >> numpy-0.9.5.2053-py2.4-macosx-10.4-ppc.egg > >> scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg > >> > >> > >> then > >> % python > >>>>> import pylab > >> Traceback (most recent call last): > >> File "<stdin>", line 1, in ? > >> File > >> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ > >> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ > >> pylab.py", > >> line 1, in ? > >> from matplotlib.pylab import * > >> File > >> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ > >> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ > >> matplotlib/__init__.py", > >> line 744, in ? > >> defaultParams =3D { > >> File > >> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ > >> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ > >> matplotlib/__init__.py", > >> line 273, in wrapper > >> ret =3D func(*args, **kwargs) > >> File > >> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ > >> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ > >> matplotlib/__init__.py", > >> line 434, in _get_data_path > >> raise RuntimeError('Could not find the matplotlib data files') > >> RuntimeError: Could not find the matplotlib data files > >> > >> BTW, are there eggs for freetype/py-gtk etc. I've been using > >> darwinports > >> till now. > > > > Did you build and install the egg yourself, or did you download it > > from somewhere? Freetype won't have an egg since it is not a python > > library. In my tests I was able to add libpng and libfreetype static > > libraries to the matplotlib egg and it worked fine. If you want, you > > can try eggs I have posted for 0.86: > > http://euclid.uits.iupui.edu/~cmoad/mpleggs/ . The matplotlib one has > > the static libs added, so I would be interested to know if it works > > for you. I can update these as well if you would like. > > > > - Charlie > > > >
Craig, Craig Maloney wrote: > Hi all. > > I have 2 issues with the contour routine. I'm just giving it a 2D > array. The first issue which is not a show stopper, is that, it uses j > for the x position and i for the y-position (where my data is given by: > M[i][j]). This seems counter intuitive. Can I switch the convention > without transposing all the data? No, you have to transpose the data. I could put in an option to determine this orientation, but I am not inclined to do so now. The present orientation follows Matlab, and is present in related functions such as imshow and pcolor. I presume the original rationale was to make everything follow the convention that just as a row of the array is printed from left to right, it should correspond to the x-axis of the plot. I agree that this conflicts with the alternative convention (i,j) -> (x,y) that one might equally well expect, however. > > The other issue seems more difficult. It seems to be ignoring any > "extent=" options I give it. Is this because I just supplied a single > 2D array rather than also supplying spatial x,y values too? No, I don't think so. Have you looked at the examples/contour_image.py? It illustrates the use of extent, as well as the way in which imshow and contour are designed to be compatible. Eric
Hi Charlie, I'm a bit new to the whole 'egg' thing. I retrieved the egg from Chris Fonnesbeck's homepage: http://homepage.mac.com/fonnesbeck/mac/ Anyway, the matplotlib data files issue is resolved, I have a copy of mpl-data in my ~/.matplotlib directory now. It is picked up as default. I tried your egg, unfortunately, I've not been able to get wxWindows installed via darwinports. I tried TkAgg, problems as well (libJPEG conflict), so I look to have a stuffed setup from darwinports. Do you have a GTKAgg backend you could add the egg? regards, Graeme On 09/02/2006, at 11:14 PM, Charlie Moad wrote: > On 2/8/06, Graeme O'Keefe <gra...@pe...> wrote: >> I'm trying to migrate from numarray to numpy. >> >> By and large it is reasonably painless, substituting itemsize for >> itemsize() >> and numarray.mlab.squeeze/tri with numpy.squeeze/tri are all I have >> encountered so far. >> >> However, I have not been able to get the numpy distribution of >> matplotlib >> working on OS-X >> >> The matplotlib egg is installed to: >> /Library/Frameworks/Python.framework/Versions/Current/lib/ >> python2.4/site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4- >> ppc.egg >> where I also have installed: >> numarray-1.5.1-py2.4-macosx-10.4-ppc.egg >> numpy-0.9.5.2053-py2.4-macosx-10.4-ppc.egg >> scipy-0.4.5.1597-py2.4-macosx-10.4-ppc.egg >> >> >> then >> % python >>>>> import pylab >> Traceback (most recent call last): >> File "<stdin>", line 1, in ? >> File >> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ >> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ >> pylab.py", >> line 1, in ? >> from matplotlib.pylab import * >> File >> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ >> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ >> matplotlib/__init__.py", >> line 744, in ? >> defaultParams = { >> File >> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ >> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ >> matplotlib/__init__.py", >> line 273, in wrapper >> ret = func(*args, **kwargs) >> File >> "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ >> site-packages/matplotlib-0.86.2cvs-py2.4-macosx-10.4-ppc.egg/ >> matplotlib/__init__.py", >> line 434, in _get_data_path >> raise RuntimeError('Could not find the matplotlib data files') >> RuntimeError: Could not find the matplotlib data files >> >> BTW, are there eggs for freetype/py-gtk etc. I've been using >> darwinports >> till now. > > Did you build and install the egg yourself, or did you download it > from somewhere? Freetype won't have an egg since it is not a python > library. In my tests I was able to add libpng and libfreetype static > libraries to the matplotlib egg and it worked fine. If you want, you > can try eggs I have posted for 0.86: > http://euclid.uits.iupui.edu/~cmoad/mpleggs/ . The matplotlib one has > the static libs added, so I would be interested to know if it works > for you. I can update these as well if you would like. > > - Charlie >
I just committed a number of changes related to the usetex option. I modified the way we scale text to handle changes in font size, this is handled by latex now and closes a long standing bug related to the rendering of extremely long strings. I believe the recent problem related to an errant font command I introduced last week have also been resolved. On Thursday 09 February 2006 13:20, Robert Hetland wrote: > My only suggestion is to poll Mac users about dvipng versions and > problems (or lack of problems). Perhaps a short term solution would > be to create an rc option that users could toggle if they were having > problems. This would at least allow us to investigate the problem > further, without too much hacking on the part of the user. Mac users can use a temporary rc parameter to get nice results with usetex. Just add text.dvipnghack : True to your matplotlibrc file. Darren
I just made a change to cvs that users should be aware of. The font.size setting in your matplotlibrc file previously defaulted to "medium", which meant 12pt. I changed it such that font.size now expects an actual number, in order to allow you, the user, to change this default size from 12.0 to whatever you like. All other font sizes, like for tick labels and axes labels, can be given in relative sizes ("small", "large", etc.). If you find that on the whole, the text in your figure is too small, you can change font.size and it will scale all the relative font sizes accordingly. I hope this is not an inconvenience to anyone. Darren
Hi all. I have 2 issues with the contour routine. I'm just giving it a 2D array. The first issue which is not a show stopper, is that, it uses j for the x position and i for the y-position (where my data is given by: M[i][j]). This seems counter intuitive. Can I switch the convention without transposing all the data? The other issue seems more difficult. It seems to be ignoring any "extent=" options I give it. Is this because I just supplied a single 2D array rather than also supplying spatial x,y values too? Thanks, Craig
I worked out the slicing Pxx, freqs, bins = matplotlib.mlab.specgram(x, NFFT, Fs, detrend, window, noverlap) #line 3377 x1,y1=Pxx.shape q=zeros([x1,y1],'d') q[:][x1/2:x1]=Pxx[:][0:x1/2] q[:][0:x1/2]=Pxx[:][x1/2:x1] Pxx=q This would be the small change needed. To me it looks like the change could be done in axes.py One could add an argument wrapparound=False and then if wrapparound new code I assume that one should do something about the y-axis as well. extent = xmin, xmax, -amax(b)/2, amax(b)/2, is probably not 100% OK but will do it for me... I guess I will have a look at psd now. I guess that will be easier /Johan On Wed, 2006年02月08日 at 22:26 +0100, Johan Nilsson wrote: > Dear group > > I am rather new to matplotlib. I have a reasonably large file of complex > valued data. Today I tried out specgram and psd, and they both work > nicely. However I would like the negative frequencies to be on the > negative side of the spectrum. I tried to look around, but could not > find any parameter to set this. My question is, if this is easily > possible or do I need to do something like > > a,b,c,d=pylab.specgram(y,1024) > pylab.show() > > x1,y1=a.shape > q=zeros([x1,y1],'d') > q[:,x1/2:x1-1]=a[:,0:x1/2-1] > q[:,0:x1/2-1]=a[:,x1-1:x1/2:-1] > > pylab.imshow(q) > > Apart from that I don't get the slicing to work properly yet, it would > be nicer if there was just a parameter to set for specgram > > > > /Johan > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
*doh* There's not supposed to be a "dot" in the rc filename... Works again. --Craig On Feb 9, 2006, at 11:44 AM, Craig Maloney wrote: > Hi Jeff, et.al. > > Funny thing... somehow during the process of installation and > moving stuff around, matplotlib has gone back to using numpy > instead of Numeric (and giving me the error messages when trying to > run contour_demo.py). > > I still have > "numerix : Numeric # Numeric or numarray" > in my .rc file. > > How can I check to make sure about which .rc file matplotlib is > trying to use? > > Thanks, Craig > > ------------------------------- > Python 2.3.3 (#2, Jan 9 2004, 13:37:22) > [GCC 3.0.1] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from pylab import * > >>> > >>> rcParams['tick.direction'] = 'out' > >>> > >>> delta = 0.025 > >>> x = arange(-3.0, 3.0, delta) > >>> y = arange(-2.0, 2.0, delta) > >>> X, Y = meshgrid(x, y) > >>> Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) > >>> Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1) > >>> # difference of Gaussians > ... Z = 10.0 * (Z2 - Z1) > >>> > ... > >>> type(X) > <class 'numarray.numarraycore.NumArray'> > ------------------------------------------------------ > > PS apparently, numpy *is* installed somewhere, I guess.... > > On Feb 9, 2006, at 10:12 AM, Jeff Whitaker wrote: > > >> Craig Maloney wrote: >> >> >>> Thanks, Jeff. >>> That did the trick. I didn't even have a .matplotlibrc file. >>> Default behavior must be numpy, huh? >>> --Craig >>> >>> >> >> Craig: >> >> If you have numpy installed, it will choose that as the default. >> If numpy is not installed, Numeric is the default. >> >> -Jeff >> >> -- >> Jeffrey S. Whitaker Phone : (303)497-6313 >> Meteorologist FAX : (303)497-6449 >> NOAA/OAR/PSD R/PSD1 Email : Jef...@no... >> 325 Broadway Office : Skaggs Research Cntr 1D-124 >> Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg >> >> > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD > SPLUNK! > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
>>>>> "Craig" == Craig Maloney <cma...@ki...> writes: Craig> Hi Jeff, et.al. Funny thing... somehow during the process Craig> of installation and moving stuff around, matplotlib has Craig> gone back to using numpy instead of Numeric (and giving me Craig> the error messages when trying to run contour_demo.py). Craig> I still have "numerix : Numeric # Numeric or numarray" in Craig> my .rc file. Craig> How can I check to make sure about which .rc file Craig> matplotlib is trying to use? run your script with > python myscript.py --verbose-helpful JDH
Hi Jeff, et.al. Funny thing... somehow during the process of installation and moving stuff around, matplotlib has gone back to using numpy instead of Numeric (and giving me the error messages when trying to run contour_demo.py). I still have "numerix : Numeric # Numeric or numarray" in my .rc file. How can I check to make sure about which .rc file matplotlib is trying to use? Thanks, Craig ------------------------------- Python 2.3.3 (#2, Jan 9 2004, 13:37:22) [GCC 3.0.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pylab import * >>> >>> rcParams['tick.direction'] = 'out' >>> >>> delta = 0.025 >>> x = arange(-3.0, 3.0, delta) >>> y = arange(-2.0, 2.0, delta) >>> X, Y = meshgrid(x, y) >>> Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) >>> Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1) >>> # difference of Gaussians ... Z = 10.0 * (Z2 - Z1) >>> ... >>> type(X) <class 'numarray.numarraycore.NumArray'> ------------------------------------------------------ PS apparently, numpy *is* installed somewhere, I guess.... On Feb 9, 2006, at 10:12 AM, Jeff Whitaker wrote: > Craig Maloney wrote: > >> Thanks, Jeff. >> That did the trick. I didn't even have a .matplotlibrc file. >> Default behavior must be numpy, huh? >> --Craig >> > > Craig: > > If you have numpy installed, it will choose that as the default. > If numpy is not installed, Numeric is the default. > > -Jeff > > -- > Jeffrey S. Whitaker Phone : (303)497-6313 > Meteorologist FAX : (303)497-6449 > NOAA/OAR/PSD R/PSD1 Email : Jef...@no... > 325 Broadway Office : Skaggs Research Cntr 1D-124 > Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg >
On Feb 9, 2006, at 12:08 PM, Darren Dale wrote: > I don't know how to proceed on this. Do I check the platform and > apply the > hack for darwin? Would that break usetex for any other mac users > out there? This is a good question.. My suspicion is that this is a problem specific to the dvipng in the I-Installer teTeX distribution. We could simply suggest to mac users to upgrade to 1.7, but dvipng is actually a pain to compile. I tried to update, but the configure script was never able to find my freetype (I only have freetype2 installed -- does dvipng require freetype 1?), and I gave up. It also wants other graphic libraries, which makes me think that this is something that people will hate more than the Ghostscript requirement. My only suggestion is to poll Mac users about dvipng versions and problems (or lack of problems). Perhaps a short term solution would be to create an rc option that users could toggle if they were having problems. This would at least allow us to investigate the problem further, without too much hacking on the part of the user. -Rob. ----- Rob Hetland, Assistant Professor Dept of Oceanography, Texas A&M University p: 979-458-0096, f: 979-845-6331 e: he...@ta..., w: http://pong.tamu.edu
Bizarre. I don't remember ever having installed numpy, it doesn't appear to be anywhere on my system, and if I do an "import numpy" it fails. Maybe matplotlib is getting confused somehow? How does it try to detect if numpy is installed? On Feb 9, 2006, at 10:12 AM, Jeff Whitaker wrote: > Craig Maloney wrote: > >> Thanks, Jeff. >> That did the trick. I didn't even have a .matplotlibrc file. >> Default behavior must be numpy, huh? >> --Craig >> > > Craig: > > If you have numpy installed, it will choose that as the default. > If numpy is not installed, Numeric is the default. > > -Jeff > > -- > Jeffrey S. Whitaker Phone : (303)497-6313 > Meteorologist FAX : (303)497-6449 > NOAA/OAR/PSD R/PSD1 Email : Jef...@no... > 325 Broadway Office : Skaggs Research Cntr 1D-124 > Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg >
On Thursday 09 February 2006 12:21, Robert Hetland wrote: > On Feb 9, 2006, at 10:35 AM, Samuel M. Smith wrote: > > So if I comment out fontenc, will that break .eps but fix .ps? > > Well, no. In my experience, this fixes EPS (which is otherwise > broken). I also got the xpdf distiller to work, which places the > fonts in the file -- good for editing in Illustrator later. Getting this result was extremely important to me. I believe that some journals will insist on being able to open the image in, say, adobe illustrator, so they can change the fonts.