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
(7) |
2
(12) |
3
(7) |
4
(23) |
5
(5) |
6
(7) |
7
(4) |
8
(7) |
9
(25) |
10
(17) |
11
(25) |
12
(11) |
13
(8) |
14
(6) |
15
(1) |
16
(22) |
17
(11) |
18
(12) |
19
(22) |
20
(32) |
21
(9) |
22
(4) |
23
(16) |
24
(5) |
25
(9) |
26
(26) |
27
(21) |
28
(14) |
29
(6) |
30
(8) |
31
(4) |
|
|
|
|
From: xyz <mi...@op...> - 2010-08-26 11:19:12
|
On 26/08/10 01:15, Benjamin Root wrote: > I believe you are asking why the x axis starts at 2? This is because > matplotlib will automatically set the limits of your plot to show all > of your data. If you can control the axes yourself by calling > set_xlim() and/or set_ylim(). > > ax.set_xlim(0.0, 5.0) > > would set the limits of your x axis to 0.0 and 5.0. You can also do > > ax.set_xlim(left=0.0) > > to control only the left end of the axis (letting the right end be > automatically set). > > I hope that helps! > Ben Root Thank you it works, but ax.set_xlim(left=0.0) does not work only ax.set_xlim(0.0) works. |
From: Tinne De L. <tin...@me...> - 2010-08-26 06:55:41
|
Hi Carlos, On Thu, Aug 26, 2010 at 04:49, Carlos Grohmann <car...@gm...> wrote: > Hello all, > > Is there a way to tell MPL that something I plotted (like a series of > Line2D, to create a grid) should not be considered for the legend? > > I'm plotting a lot of things, and because of these objects (without > label), I always got these msgs: > > /usr/lib/pymodules/python2.6/matplotlib/axes.py:4014: UserWarning: No > labeled objects found. Use label='...' kwarg on individual plots. > warnings.warn("No labeled objects found. " > I always use the following set of commands to get costumize my legend: ************************************** legendEntries=[] # list of plots that are going to be in the legend legendText=[] # list of text messages for the legend thisPlot = plot(x,y,'b*') # a plot command legendEntries.append(thisPlot) # only do this for the plots you want to add to the legend legendText.append("legend text") # only this for the plots you want to add to the legend lgd = legend(legendEntries,legendText,numpoints=1,prop=props,loc='upper right') # example of how to draw the legend ************************************** Hope this helps, Tinne |
From: dcarroll <spa...@gm...> - 2010-08-26 03:48:03
|
I am trying make a plot that is in a loop and replots when new data is updated. #IN A LOOP fig = plt.figure(1,[10,10]) fig.clf prop = matplotlib.font_manager.FontProperties(size=8) xMin = dates[1] xMax = dates[-1] #temperature plot yMin = min(temperatureSQLData) yMax = max(temperatureSQLData) minTemperature = "Min = %.3f " % min(temperatureSQLData) + 'deg ' + 'C' minTemperatureIndex = temperatureSQLData.index(yMin) maxTemperature = "Max = %.3f " % max(temperatureSQLData) + 'deg ' + 'C' maxTemperatureIndex = temperatureSQLData.index(yMax) ax1 = fig.add_subplot(511) ax1.cla plt.hold(True) plt.plot(dates,temperatureSQLData,'r') plt.plot(dates[minTemperatureIndex],yMin,'ro',label=minTemperature) plt.plot(dates[maxTemperatureIndex],yMax,'bo',label=maxTemperature) plt.hold(False) plt.title("Water Conditions for the last 7 Days.") plt.xlim([xMin,xMax]) plt.ylim([yMin-1,yMax+1]) plt.ylabel('Temperature') ax1.legend(numpoints=1,prop=prop) dateFormat = mpl.dates.DateFormatter('%m/%d/%Y') ax1.xaxis.set_major_formatter(dateFormat) daysLocation = mpl.dates.DayLocator() ax1.xaxis.set_major_locator(daysLocation) hoursLocation = mpl.dates.HourLocator(interval=4) ax1.xaxis.set_minor_locator(hoursLocation) The problem is that the number of items in my legend grows with each iteration of the loop. Any help would be appreciated! -- View this message in context: http://old.nabble.com/My-Legend-keeps-growing%21-Help-tp29538626p29538626.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Carlos G. <car...@gm...> - 2010-08-26 02:50:25
|
Hello all, Is there a way to tell MPL that something I plotted (like a series of Line2D, to create a grid) should not be considered for the legend? I'm plotting a lot of things, and because of these objects (without label), I always got these msgs: /usr/lib/pymodules/python2.6/matplotlib/axes.py:4014: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots. warnings.warn("No labeled objects found. " Tks -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano http://lattes.cnpq.br/5846052449613692 Linux User #89721 ________________ Can’t stop the signal. |
From: Friedrich R. <fri...@gm...> - 2010-08-25 23:10:48
|
2010/8/25 Jeff Whitaker <js...@fa...>: > gcc-4.2 is the default compiler for 10.6 - I wonder if you need to > upgrade your dev tools? Xcode 3.2.2 is available for download (free > with registration) from Apple. No, he's using Python.org Python I believe, and that was compiled with gcc-4.0. So distutils picks up gcc-4.0, and that is correct. Joses, can you give some more lines of the output, or post the complete log in some pastebin? Please give the output starting from the offending gcc call at least. I just do not recall atm what the problem is people have when coming with this issue, so please help me a little ;-) python setup.py build (or install) is a good approach, it gives you more control than make.osx. Be aware of that nevertheless the official approach others on this list will recommend seems to be make.osx (sorry John), and most people use that. But make.osx afaik **installs libraries in your /usr/local directory without asking you if you want that**, if you do not take special care before (John, please correct me if I'm wrong here! But it is what I remember from my glimpse into make.osx). Bear that in mind. I believe it's better to compile the libs (like freetype and pnglib) yourself where you know what you're doing. So, have you compiled at all and if yes using which compiler freetype2 and libpng 1.4? The records of this list are outdated in that respect that *no* additional tuning is necessary with mpl 1.0 now to use libpng 1.4 instead of the older 1.2. When mpl setup.py starts there is a section between ====== lines, can you please post also that. Ah, and for sure you should modify your setupext.py, search for 'darwin' and add in the dictionary entry you will find, '/usr/local' to the list of the dict value for the key 'darwin'. Then the libs installed will be found. Before this is unlikely. Friedrich |
From: Bala s. <bal...@gm...> - 2010-08-25 16:11:07
|
Friends, 1) I want to remove the rectangular box around the legend. How to do the same. I apologize if this query had been asked before. 2) reduce the distance (vertical) between two legends in the same plot. Thanks, Bala |
From: Benjamin R. <ben...@ou...> - 2010-08-25 15:21:34
|
On Wed, Aug 25, 2010 at 4:53 AM, xyz <mi...@op...> wrote: > Thank you, but why the coordinates start from 2 and not from 0 with the > following code? > > from pylab import * > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(111) > > for i in [[2,2], [2,3], [4.2,3.5]]: > print i[0],i[1] > plt.plot(i[0],i[1],'o') > > ax.grid(True) > plt.legend(['Model length', 'Data length', 'test'], > 'best', shadow=True, fancybox=True) > > plt.show() > > How is it possible that the coordinates start from 0? > > > I believe you are asking why the x axis starts at 2? This is because matplotlib will automatically set the limits of your plot to show all of your data. If you can control the axes yourself by calling set_xlim() and/or set_ylim(). ax.set_xlim(0.0, 5.0) would set the limits of your x axis to 0.0 and 5.0. You can also do ax.set_xlim(left=0.0) to control only the left end of the axis (letting the right end be automatically set). I hope that helps! Ben Root |
From: Benjamin R. <ben...@ou...> - 2010-08-25 15:06:41
|
On Tue, Aug 24, 2010 at 10:28 PM, David Pine <dj...@gm...> wrote: > I am trying to save the frames from a matplotlib animation and I have a > question that is undoubtedly based on a profound lack of understanding about > how matplotlib/python works, but I'm hoping someone can offer me an > explanation. The following code is excerpted from the animation examples > "animation_blit_wx.py". The example works fine unless I include the #***** > line meant to record the animations in included. If the line is included, > the animated line is no longer drawn to the screen or to the sequence of > plots I am trying to save. That is, the background is displayed and saved, > but not the animated line. Why? > > > def update_line(*args): > global blit_time > > if update_line.background is None: > update_line.background = canvas.copy_from_bbox(ax.bbox) > > # restore the clean slate background > canvas.restore_region(update_line.background) > # update the data > line.set_ydata(npy.sin(x+update_line.cnt/10.0)) > # just draw the animated artist > ax.draw_artist(line) > # just redraw the axes rectangle > > t = time.time() > canvas.blit(ax.bbox) > blit_time += time.time() - t > #***** plt.savefig('f' + str(update_line.cnt) + '.png') ***** > > if update_line.cnt == NBLITS: > # print the timing info and quit > frame_time = time.time() - tstart > print '%d frames: %.2f seconds' % (NBLITS, frame_time) > print '%d blits: %.2f seconds' % (NBLITS, blit_time) > print > print 'FPS: %.2f' % (NBLITS/frame_time) > print 'BPS: %.2f' % (NBLITS/blit_time) > sys.exit() > > update_line.cnt += 1 > wx.WakeUpIdle() > > > Technically speaking, animation to the screen is completely different from what you are trying to do here. When showing an animation to the screen, a bunch of tricks are needed to make it efficient and for looping. However, if you only wish to save the individual frames, I would suggest that you just simply create your figures normally (none of this blitting and update_lines stuff) and save each of them as you would normally. Be sure to call clf() to prevent memory usage to grow out of control. Persoanlly, I then use ImageMagick to merge the image files together into an animated gif: convert `ls -1 *.png | sort -d` -set delay 40 -set dispose none -loop 0 animation.gif The experimental Animation module will have some preliminary support for saving animations (that feature isn't cross-platform right now). Ben Root |
From: Jeff W. <js...@fa...> - 2010-08-25 14:56:38
|
On 8/25/10 3:53 AM, Joses Ho wrote: > Hi, > > I run Mac OS X 10.6.4 with the official Python 2.6.3 distribution. I have already installed NumPy ver 1.4.1. > > I downloaded and unzipped the matplotlib-1.0.0.tar.gz from the SourceForge site. > > When I enter the command : > python setup.py install > > It finally gives me the following error right at the end of a huge chunk of output: > > lipo: can't figure out the architecture type of: /var/folders/mC/mC4L2rRBGEChqn7bv1iNd++++TI/-Tmp-//cc0Tc9za.out > error: command 'gcc-4.0' failed with exit status 1 > > Any help here would be much appreciated. > > Thanks, > Joses Joses: gcc-4.2 is the default compiler for 10.6 - I wonder if you need to upgrade your dev tools? Xcode 3.2.2 is available for download (free with registration) from Apple. -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-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Joses Ho <jo...@we...> - 2010-08-25 10:09:37
|
Hi, I run Mac OS X 10.6.4 with the official Python 2.6.3 distribution. I have already installed NumPy ver 1.4.1. I downloaded and unzipped the matplotlib-1.0.0.tar.gz from the SourceForge site. When I enter the command : python setup.py install It finally gives me the following error right at the end of a huge chunk of output: lipo: can't figure out the architecture type of: /var/folders/mC/mC4L2rRBGEChqn7bv1iNd++++TI/-Tmp-//cc0Tc9za.out error: command 'gcc-4.0' failed with exit status 1 Any help here would be much appreciated. Thanks, Joses |
From: xyz <mi...@op...> - 2010-08-25 09:54:11
|
Thank you, but why the coordinates start from 2 and not from 0 with the following code? from pylab import * import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) for i in [[2,2], [2,3], [4.2,3.5]]: print i[0],i[1] plt.plot(i[0],i[1],'o') ax.grid(True) plt.legend(['Model length', 'Data length', 'test'], 'best', shadow=True, fancybox=True) plt.show() How is it possible that the coordinates start from 0? On 24/08/10 22:43, Michael Droettboom wrote: > You have plotted three lines, but only provided legend labels for two of > them. Try: > > plt.legend(('Model length', 'Data length', 'Something else'), > 'best', shadow=True, fancybox=True) > > > Mike > > On 08/24/2010 06:33 AM, xyz wrote: > >> Hello, >> the following script creates a legend for only two instead of three >> datasets. >> ----------- >> from pylab import * >> import matplotlib.pyplot as plt >> >> fig = plt.figure() >> ax = fig.add_subplot(111) >> >> for i in [[2,2], [2,3], [4.2,3.5]]: >> print i[0],i[1] >> plt.plot(i[0],i[1],'o') >> >> ax.grid(True) >> plt.legend(('Model length', 'Data length'), >> 'best', shadow=True, fancybox=True) >> >> plt.show() >> ----------------- >> >> What did I wrong. >> >> Thank you in advance. >> >> ------------------------------------------------------------------------------ >> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program >> Be part of this innovative community and reach millions of netbook users >> worldwide. Take advantage of special opportunities to increase revenue and >> speed time-to-market. Join now, and jumpstart your future. >> http://p.sf.net/sfu/intel-atom-d2d >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > |
From: Daπid <dav...@gm...> - 2010-08-25 09:37:32
|
I cannot see what is wrong, but after saving each figure you should add plt.clf() in order to delete the image and preventing memory leaks, because MPL stores one image in top of the other. For the filecode I suggest you to use something like: savefig(head+str(filecode).zfill(digits)+format, dpi=205) filecode+=1 where head is the name, digits an int and format usually .png. Which backend are you using? Do you need it to be displayed on screen? If not, the backend Agg is best. Regards, David. On Wed, Aug 25, 2010 at 5:28 AM, David Pine <dj...@gm...> wrote: > I am trying to save the frames from a matplotlib animation and I have a question that is undoubtedly based on a profound lack of understanding about how matplotlib/python works, but I'm hoping someone can offer me an explanation. The following code is excerpted from the animation examples "animation_blit_wx.py". The example works fine unless I include the #***** line meant to record the animations in included. If the line is included, the animated line is no longer drawn to the screen or to the sequence of plots I am trying to save. That is, the background is displayed and saved, but not the animated line. Why? > > > def update_line(*args): > global blit_time > > if update_line.background is None: > update_line.background = canvas.copy_from_bbox(ax.bbox) > > # restore the clean slate background > canvas.restore_region(update_line.background) > # update the data > line.set_ydata(npy.sin(x+update_line.cnt/10.0)) > # just draw the animated artist > ax.draw_artist(line) > # just redraw the axes rectangle > > t = time.time() > canvas.blit(ax.bbox) > blit_time += time.time() - t > #***** plt.savefig('f' + str(update_line.cnt) + '.png') ***** > > if update_line.cnt == NBLITS: > # print the timing info and quit > frame_time = time.time() - tstart > print '%d frames: %.2f seconds' % (NBLITS, frame_time) > print '%d blits: %.2f seconds' % (NBLITS, blit_time) > print > print 'FPS: %.2f' % (NBLITS/frame_time) > print 'BPS: %.2f' % (NBLITS/blit_time) > sys.exit() > > update_line.cnt += 1 > wx.WakeUpIdle() > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: David P. <dj...@gm...> - 2010-08-25 03:29:07
|
I am trying to save the frames from a matplotlib animation and I have a question that is undoubtedly based on a profound lack of understanding about how matplotlib/python works, but I'm hoping someone can offer me an explanation. The following code is excerpted from the animation examples "animation_blit_wx.py". The example works fine unless I include the #***** line meant to record the animations in included. If the line is included, the animated line is no longer drawn to the screen or to the sequence of plots I am trying to save. That is, the background is displayed and saved, but not the animated line. Why? def update_line(*args): global blit_time if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) # restore the clean slate background canvas.restore_region(update_line.background) # update the data line.set_ydata(npy.sin(x+update_line.cnt/10.0)) # just draw the animated artist ax.draw_artist(line) # just redraw the axes rectangle t = time.time() canvas.blit(ax.bbox) blit_time += time.time() - t #***** plt.savefig('f' + str(update_line.cnt) + '.png') ***** if update_line.cnt == NBLITS: # print the timing info and quit frame_time = time.time() - tstart print '%d frames: %.2f seconds' % (NBLITS, frame_time) print '%d blits: %.2f seconds' % (NBLITS, blit_time) print print 'FPS: %.2f' % (NBLITS/frame_time) print 'BPS: %.2f' % (NBLITS/blit_time) sys.exit() update_line.cnt += 1 wx.WakeUpIdle() |
From: Michael D. <md...@st...> - 2010-08-24 12:43:36
|
You have plotted three lines, but only provided legend labels for two of them. Try: plt.legend(('Model length', 'Data length', 'Something else'), 'best', shadow=True, fancybox=True) Mike On 08/24/2010 06:33 AM, xyz wrote: > Hello, > the following script creates a legend for only two instead of three > datasets. > ----------- > from pylab import * > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(111) > > for i in [[2,2], [2,3], [4.2,3.5]]: > print i[0],i[1] > plt.plot(i[0],i[1],'o') > > ax.grid(True) > plt.legend(('Model length', 'Data length'), > 'best', shadow=True, fancybox=True) > > plt.show() > ----------------- > > What did I wrong. > > Thank you in advance. > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA |
From: xyz <mi...@op...> - 2010-08-24 10:34:04
|
Hello, the following script creates a legend for only two instead of three datasets. ----------- from pylab import * import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) for i in [[2,2], [2,3], [4.2,3.5]]: print i[0],i[1] plt.plot(i[0],i[1],'o') ax.grid(True) plt.legend(('Model length', 'Data length'), 'best', shadow=True, fancybox=True) plt.show() ----------------- What did I wrong. Thank you in advance. |
From: xiaoni <wa...@ya...> - 2010-08-24 10:13:08
|
Hello, Benjamin, Thanks for your quick response ! I found that I only need use clf(), and then everything is fine ! The code can be run quickly and I can exit ipython gracefully afterwards. So it is not a problem of backend, just of clearing the existing figures properly ! (close() is not good because the figures are not displayed.) cheers, xiaoni ________________________________ From: Benjamin Root <ben...@ou...> To: xiaoni <wa...@ya...> Cc: mat...@li... Sent: Tue, August 24, 2010 2:29:32 AM Subject: Re: [Matplotlib-users] a question about backend, matplotlib and ipython On Mon, Aug 23, 2010 at 1:53 PM, xiaoni <wa...@ya...> wrote: Hello, > I got a problem with backend in matplotlib. > I used ipython for launching the codes and the backend of >matplotlib is GTKAgg. I have a code.py with a for loop for processing data, >and in each iteration I read and plot and save the figures. Because >there are so many figures, I set the non-interative mode and not using >"show()" in the code. Then the memory is used more and more as the >iteration number increases, and the most memory is due to write_png >function. I guess that the figures (though not shown on the screen) >from each iteration take the memory, and try to close the figures produced at >each iteration. >what I did: >modify the backend to Agg in the code >add "close('all')" before each iteration finish. > > This works for removing the memory problem. But a new issue arrive. >After the run is finished, the ipython command window has no response >to any keyboard input for a few seconds, then a warning message appear: > "Warning: Timeout for mainloop thread exceeded switching to >nonthreaded mode (until mainloop wakes up again)", >and when I tried to quit ipython afterwards, it is stuck there and the >ipython is crashed. > But if I tried using "python code.py" , then it works well : no warnings. > Does it mean that we can not use ipython and a backend non-GUI at the same >time ? > > Any one would like to explain a bit ? Thanks in advance !! > > >xiaoni > > xiaoni, For the way that you appear to be using ipython, it might be better to just use regular python instead. ipython is very useful for interactive systems and other advanced topics, but for a simple, loop-driven image generator, python will work just fine. As for your memory usage, doing a clf() should be helpful to keep it under control. I should also note that ipython have been known to cause memory use to grow due to the extra references it holds to the figure data, although I don't know if this is still true in the latest version that is currently being worked on. I hope this helps, Ben Root |
From: Chloe L. <ch...@be...> - 2010-08-24 06:24:36
|
And if you have mutually prime numbers of colors, linestyles, widths, you can automatically generate more distinct lines than I can distinguish... If there's any wxcuse for treating them as a series, I replot when I know how many I have, and space the colors through a colorbar. &C Away from home, checking mail rarely. On Aug 23, 2010, at 2:11 PM, John Salvatier <jsalvati@u.washington.edu> wrote: > By the way, I found that the following generator expression made > things easy: > > def styles(): > return ( {'c' : color, 'ls' : style, 'lw' : width} for color, > style, width in itertools.product(colors, linestyles, linewidths)) > > then you can do something like > > for result, style in zip(results, styles()): > pylab.plot(result[i], **style) > > On Mon, Aug 23, 2010 at 1:22 PM, John Salvatier <jsalvati@u.washington.edu > > wrote: > Thanks! > > > On Mon, Aug 23, 2010 at 12:38 PM, Aman Thakral > <ama...@gm...> wrote: > Hi John, > > Here is a simple way to do it. > > import matplotlib.pyplot as plt > import numpy as np > fig = plt.figure() > ax = fig.add_subplot(111) > > colors = ('red','green','blue','yellow','orange') > linestyles = ('-','--',':') > linewidths = (0.5,2) > > y = np.random.randn(100,30) > x = range(y.shape[0]) > i = 0 > > for c in colors: > for ls in linestyles: > for lw in linewidths: > ax.plot(x,y[:,i],c=c,ls=ls,lw=lw) > i+=1 > plt.show() > > > > On 10-08-23 03:06 PM, John Salvatier wrote: >> Hello, >> >> I have a plot with lots of curves on it (say 30), and I would like >> to have some way of distinguishing the curves from each other. Just >> plotting them works well for a few curves because they come out as >> different colors unless you specify otherwise, but if you do too >> many you start getting repeats is there a way to have matplotlib >> also vary the line style that it automatically assigns? Or perhaps >> someone has another way of distinguishing lots of curves? >> >> Best Regards, >> John >> >> >> --- >> --- >> --- >> --------------------------------------------------------------------- >> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program >> Be part of this innovative community and reach millions of netbook >> users >> worldwide. Take advantage of special opportunities to increase >> revenue and >> speed time-to-market. Join now, and jumpstart your future. >> http://p.sf.net/sfu/intel-atom-d2d >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > > --- > --- > --- > --------------------------------------------------------------------- > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook > users > worldwide. Take advantage of special opportunities to increase > revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Benjamin R. <ben...@ou...> - 2010-08-24 00:29:58
|
On Mon, Aug 23, 2010 at 1:53 PM, xiaoni <wa...@ya...> wrote: > Hello, > I got a problem with backend in matplotlib. > I used ipython for launching the codes and the backend of matplotlib > is GTKAgg. I have a code.py with a for loop for processing data, and in > each iteration I read and plot and save the figures. Because there are so > many figures, I set the non-interative mode and not using "show()" in the > code. Then the memory is used more and more as the iteration number > increases, and the most memory is due to write_png function. I guess that > the figures (though not shown on the screen) from each iteration take the > memory, and try to close the figures produced at each iteration. > what I did: > modify the backend to Agg in the code > add "close('all')" before each iteration finish. > > This works for removing the memory problem. But a new issue arrive. > After the run is finished, the ipython command window has no response to any > keyboard input for a few seconds, then a warning message appear: > "Warning: Timeout for mainloop thread exceeded switching to nonthreaded > mode (until mainloop wakes up again)", > and when I tried to quit ipython afterwards, it is stuck there and the > ipython is crashed. > But if I tried using "python code.py" , then it works well : no > warnings. > Does it mean that we can not use ipython and a backend non-GUI at the > same time ? > > Any one would like to explain a bit ? Thanks in advance !! > > > xiaoni > > > xiaoni, For the way that you appear to be using ipython, it might be better to just use regular python instead. ipython is very useful for interactive systems and other advanced topics, but for a simple, loop-driven image generator, python will work just fine. As for your memory usage, doing a clf() should be helpful to keep it under control. I should also note that ipython have been known to cause memory use to grow due to the extra references it holds to the figure data, although I don't know if this is still true in the latest version that is currently being worked on. I hope this helps, Ben Root |
From: John S. <jsalvati@u.washington.edu> - 2010-08-23 21:11:36
|
By the way, I found that the following generator expression made things easy: def styles(): return ( {'c' : color, 'ls' : style, 'lw' : width} for color, style, width in itertools.product(colors, linestyles, linewidths)) then you can do something like for result, style in zip(results, styles()): pylab.plot(result[i], **style) On Mon, Aug 23, 2010 at 1:22 PM, John Salvatier <jsalvati@u.washington.edu>wrote: > Thanks! > > > On Mon, Aug 23, 2010 at 12:38 PM, Aman Thakral <ama...@gm...>wrote: > >> Hi John, >> >> Here is a simple way to do it. >> >> import matplotlib.pyplot as plt >> import numpy as np >> fig = plt.figure() >> ax = fig.add_subplot(111) >> >> colors = ('red','green','blue','yellow','orange') >> linestyles = ('-','--',':') >> linewidths = (0.5,2) >> >> y = np.random.randn(100,30) >> x = range(y.shape[0]) >> i = 0 >> >> for c in colors: >> for ls in linestyles: >> for lw in linewidths: >> ax.plot(x,y[:,i],c=c,ls=ls,lw=lw) >> i+=1 >> plt.show() >> >> >> >> On 10-08-23 03:06 PM, John Salvatier wrote: >> >> Hello, >> >> I have a plot with lots of curves on it (say 30), and I would like to have >> some way of distinguishing the curves from each other. Just plotting them >> works well for a few curves because they come out as different colors unless >> you specify otherwise, but if you do too many you start getting repeats is >> there a way to have matplotlib also vary the line style that it >> automatically assigns? Or perhaps someone has another way of distinguishing >> lots of curves? >> >> Best Regards, >> John >> >> >> ------------------------------------------------------------------------------ >> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program >> Be part of this innovative community and reach millions of netbook users >> worldwide. Take advantage of special opportunities to increase revenue and >> speed time-to-market. Join now, and jumpstart your future. >> http://p.sf.net/sfu/intel-atom-d2d >> >> >> _______________________________________________ >> Matplotlib-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> > |
From: John S. <jsalvati@u.washington.edu> - 2010-08-23 20:22:26
|
Thanks! On Mon, Aug 23, 2010 at 12:38 PM, Aman Thakral <ama...@gm...>wrote: > Hi John, > > Here is a simple way to do it. > > import matplotlib.pyplot as plt > import numpy as np > fig = plt.figure() > ax = fig.add_subplot(111) > > colors = ('red','green','blue','yellow','orange') > linestyles = ('-','--',':') > linewidths = (0.5,2) > > y = np.random.randn(100,30) > x = range(y.shape[0]) > i = 0 > > for c in colors: > for ls in linestyles: > for lw in linewidths: > ax.plot(x,y[:,i],c=c,ls=ls,lw=lw) > i+=1 > plt.show() > > > > On 10-08-23 03:06 PM, John Salvatier wrote: > > Hello, > > I have a plot with lots of curves on it (say 30), and I would like to have > some way of distinguishing the curves from each other. Just plotting them > works well for a few curves because they come out as different colors unless > you specify otherwise, but if you do too many you start getting repeats is > there a way to have matplotlib also vary the line style that it > automatically assigns? Or perhaps someone has another way of distinguishing > lots of curves? > > Best Regards, > John > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > > > _______________________________________________ > Matplotlib-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > |
From: Aman T. <ama...@gm...> - 2010-08-23 19:39:04
|
Hi John, Here is a simple way to do it. import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(111) colors = ('red','green','blue','yellow','orange') linestyles = ('-','--',':') linewidths = (0.5,2) y = np.random.randn(100,30) x = range(y.shape[0]) i = 0 for c in colors: for ls in linestyles: for lw in linewidths: ax.plot(x,y[:,i],c=c,ls=ls,lw=lw) i+=1 plt.show() On 10-08-23 03:06 PM, John Salvatier wrote: > Hello, > > I have a plot with lots of curves on it (say 30), and I would like to > have some way of distinguishing the curves from each other. Just > plotting them works well for a few curves because they come out as > different colors unless you specify otherwise, but if you do too many > you start getting repeats is there a way to have matplotlib also vary > the line style that it automatically assigns? Or perhaps someone has > another way of distinguishing lots of curves? > > Best Regards, > John > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Friedrich R. <fri...@gm...> - 2010-08-23 19:28:55
|
2010/8/20 Bruce Ford <br...@cl...>: > I have a grid with values ranging from exactly 0.0 and 100.0. When I > plot this with colorbar, the base of the colorbar is labeled "-0.0". > Is this a default for 0.0...to plot it with as a negative number? Any > workarounds? How sure are you that the floating point number underneath has really not set the negative bit? Maybe try to .clip() the grid positions before on the numpy level to (0.0, \infty) where 0 arises from a fresh parse of '0.0' by the interpreter, i.e., a "really really zero" fp number. To clip, you may also use grid *= (grid > 0) or similar things of that fashion. I'm not sure if the mistake is implied my your side of the code, but i just hope this helps maybe. The Locator stuff is not soo easy. Friedrich |
From: Justin M. <jn...@gm...> - 2010-08-23 19:28:13
|
Here are a couple of functions you might try, with a few colors and line styles I use: import itertools from pylab import * COLORS = ['#990033', '#0000FF', '#00FF00', '#F79E00', '#ff00ff', '#0080FF', '#FF0000', '#2D0668', '#2EB42E', '#ff6633', '#8000ff', '#666633', '#cc0077', '#099499', '#996633', '#000000'] def new_stylecolor_iter(): ## Use these to alternate markers, or use all the styles. ## Combine them into the call to 'itertools.product' and ## then add the appropriate kwargs to the call to 'plot' #markers = itertools.cycle(lines.Line2D.markers.keys()) #styles = itertools.cycle(lines.Line2D.lineStyles.keys()) ## alternate colors first, line styles second sc = itertools.product(['-', ':', '--', '-.'], COLORS) return sc def line_plot_alternate(): sc = new_stylecolor_iter() for i in xrange(0,40): style, color = sc.next() plot(xrange(0,20), randn(20), label=str(i), linewidth=3, linestyle=style, color=color) legend() if __name__ == "__main__": line_plot_alternate() show() On Mon, Aug 23, 2010 at 3:06 PM, John Salvatier <jsalvati@u.washington.edu>wrote: > Hello, > > I have a plot with lots of curves on it (say 30), and I would like to have > some way of distinguishing the curves from each other. Just plotting them > works well for a few curves because they come out as different colors unless > you specify otherwise, but if you do too many you start getting repeats is > there a way to have matplotlib also vary the line style that it > automatically assigns? Or perhaps someone has another way of distinguishing > lots of curves? > > Best Regards, > John > > > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Friedrich R. <fri...@gm...> - 2010-08-23 19:17:02
|
2010/8/20 Benjamin Root <ben...@ou...>: > This used to trip me up as well. However, for colors in matplotlib, None > (without quotes) tells mpl to use the default color, while 'None' (typically > not case-sensitive) means "do not plot any color". More precise, the string 'None' translates to fully transparent black, as far as I understand. The ps backend e.g. ignores such objects when printing out then. Freidrich |
From: Friedrich R. <fri...@gm...> - 2010-08-23 19:11:45
|
2010/8/20 Michael Droettboom <md...@st...>: >> Yeah, it's my issue, but I'm not happy with fixing it. Currently, >> matplotlib forces the xticks (i.e., the theta ticks) to be at sensible >> values via .set_xticks() and .set_xlabels() (projections/polar.py). >> >> I'm coding a matplotlib extension package which has to clear the axes >> often, but restoring the major locators, the title and stuff after >> clearing. It was agnostic to the specialities of polar axes so far. > > Why and how are you restoring the major locator? It seems like that's the > issue. I don't think preventing the theta locator from being changed is > something we want to do. Polar plots (by default) just set fixed theta > ticks at multiples of pi/4. My package provides support for Layers in matplotlib. And the layers' data can be changed, making a complete redraw of the axes a solution much easier to implement than dealing with the fuzzy API stuff directly. I don't need high-performance. When putting axes.clear(), the locator is being reset. In cartesian coords, it happens that I want a MaxNLocator(nbins=3) or similiar from time to time, and this must be restored then. For cartesian axes, if the user does not specify another locator, I'm setting the AutoLocator(), what is the same what the (cartesian) axes does. Dealing with the case "no locator set" (by "using matplotlib default fallback") is neither nice nor straightforward. (It has to do with complicating the calling conventions. I would have to treat the case 'ignore [x|y]locator' specially.) It would maybe be a good solution to provide some abstract Axes.get_default_locators(), being public. Each SomeClass(Axes) can define what they understand under "default locator". >> I would rather suggest to insert a new Locator class being aware of >> radians. It would suffice to return tick positions dividing 2 pi into >> an integer number of bins. It's not necessary to cover all the >> peculiarities of the old historic division system into 360 parts. > > Perhaps using FixedLocator, rather than explicitly setting the ticks using > set_xticks (as polar plots currently do) would be better. However, the > locator could still be changed, not really addressing your problem. Seems that you misunderstood my problem, if I'm not misunderstanding you :-) I have no problem with a "mutable" locator. (But the user has normally no access to the axes, only the Stack class changes the axes.) But right, I wanted to derive it from the Locator class framework, just specialising the location. > For convenience, however, we could add a locator that given n, divides 2pi > into n parts. Yes, and Ben's idea is quite nice, to make this accessible also to rectangular plots. This implies some simple thoughts on the view lims to take them into account when issuing the tick locations. >> Accompanying would be formatters in radians and degrees with >> adjustable precision (no autodetect necessary). > > Sure. Adding a radian formatter makes sense. If we go into details let's switch to -devel maybe? Friedrich |