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
(20) |
2
(16) |
3
(9) |
4
(12) |
5
(14) |
6
(22) |
7
(17) |
8
(33) |
9
(26) |
10
(32) |
11
(47) |
12
(26) |
13
(7) |
14
(24) |
15
(44) |
16
(42) |
17
(22) |
18
(31) |
19
(8) |
20
(4) |
21
(15) |
22
(27) |
23
(41) |
24
(33) |
25
(31) |
26
(24) |
27
(10) |
28
(20) |
|
|
|
|
|
|
Hi, I'm trying to get manual labeling of contours to work: import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt delta = 0.025 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0, delta) X, Y = np.meshgrid(x, y) Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) # difference of Gaussians Z = 10.0 * (Z2 - Z1) plt.figure() CS = plt.contour(X, Y, Z, 6, linewidths=np.arange(.5, 4, .5), colors=('r', 'green', 'blue', (1,1,0), '#afeeee', '0.5') ) plt.clabel(CS, fontsize=9, inline=1, manual=True) plt.title('Crazy lines') plt.show() On my macbook, clicking with the touchpad does not seem to work. Any ideas? David.
I wrote a bunch of graph scripts for creating on-the-fly line plots with django. Since I'm running the site on a low memory VPS, I need to run apache in multi-threaded mode, which means all my code needs to be thread-safe. I was using Pyplot a lot, which is not thread-safe. A solution I came up with which worked pretty well was to replace this: import matplotlib.pyplot as plt self.fig = plt.figure(figsize=(3.5, 2.5),) with this: from matplotlib.figure import Figure self.fig = Figure(figsize=(3.5, 2.5),) It worked like a charm on all my graphs. I have a few maps that I created with Basemap which this method does not seem to work on. My code works perfectly fine with the first snippet posted above, but if I change it to the snippet below, I get this error: File "/srv/proj/maps/states.py" in as_response 40. return plot_png2(self.plot).__call__() File "/srv/proj/graphs/image_formats.py" in __call__ 50. edgecolor="white") File "/usr/lib/pymodules/python2.6/matplotlib/figure.py" in savefig 1033. self.canvas.print_figure(*args, **kwargs) the second item in the traceback is this line: fig.savefig(response, format=self.extension, bbox_inches="tight", pad_inches=.05, edgecolor="white") Any ideas on whats going on here? -- View this message in context: http://old.nabble.com/matplotlib.figure-and-basemap-tp27477116p27477116.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Fri, Feb 5, 2010 at 3:46 PM, David MacQuigg <mac...@ec...> wrote: > > I can't get Matplotlib to work with IDLE. plt.show() makes beutiful plots, > but IDLE is hung. Entering "exit" in the little pop-up console window > raises an exception in IDLE, and then leaves the plot window hung. It looks > like the old "dualing event loops" problem with IDLE, although the > Matplotlib docs don't use that phrase. > > The way I ususally solve this is to use IDLE for editing my scripts, and a > separate shell to actually run them. Here, I'm not using a saved script. > This needs to work interactively, for students using Python in a physics > class. I see that little console window, and it sure looks like that was > intended to do what I need, but I can't find any documentation on the > commands. How do I switch back and forth between IDLE and the plot window > without leaving some process in limbo? Even better, is there an option to > have the event loop automatically switch back to IDLE after each update? > > I'm running on Mac OS-X, so it looks like IPython is not an option. Also, I > would rather stick with IDLE. It is the perfect IDE for non-CS students who > shouldn't be spending their time on the complexities of a plotting package. There's a different version of Idle called VIdle that is supposed to fix certain problems. I haven't a clue if yours is one of them, but you might try it. It comes standard in VPython http://www.vpython.org ... I don't know if it's available separately. > > -- > View this message in context: http://old.nabble.com/Matplotlib-conflicts-with-IDLE-tp27473693p27473693.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
David Goldsmith wrote: > On Mon, Oct 6, 2008 at 10:56 AM, Eric Firing <ef...@ha... > <mailto:ef...@ha...>> wrote: > > Christopher Barker wrote: > > David Goldsmith wrote: > > I feel like I must be missing something > > > yup -- though it's an understandable miss... > > > I think the longstanding separation between the figure.dpi and the > savefig.dpi is a continual gotcha that we can and should eliminate. > Savefig should use the figure dpi, so that what is saved corresponds > to what is on the screen, unless explicitly overridden. One way to > reduce the problem, with what I hope is an adequate level of > backwards compatibility, would be to have the savefig.dpi default to > a special flag setting that means "track the figure.dpi". For > example, savefig.dpi could be the string, 'screen', by default. This > could still be overridden by a numerical rcParams setting, or by the > explicit dpi kwarg setting in savefig() or print_figure(). > > There are still other highly confusing dpi things internally--such > as a renderer.dpi setting that is ignored during rendering. > > Comments? > > > This appears to have never been "fixed" (though I see no opposition > expressed looking back at the original thread in the archive) - having > forgotten about it and the fact that, at the time, it sent me running to > PIL, I got bitten by it again (luckily I had a vague recollection of > this thread before posting the same problem again and making a complete > ass outta myself). I'm not sure if I have the bleeding edge version of > MPL, but as I'm now working on the second different computer I've had > since the OP, I'm pretty sure I'm running a later version than I was > back then. Did this issue ever mature into a ticket? > Not that I know of. I never got back to it, and I don't think anyone else did, either. Eric > DG > > > > Eric > > > > > Attached are the results on my computer (see usage details > below). > Granted, I'm increasing the resolution each iteration, > > > you are increasing the resolution of the figure, and of your > calculations, but NOT of the output image. The hint was that > every image was the same size: 1200X900 , which is 12"x9" at 100 > dpi. > > It turns out that print_figure() doesn't respect the figures > (native DPI), it defaults to 100 dpi, but you can override it: > > > canvas.print_figure("test"+str(DPI)+"dpi.png", dpi=DPI) > > Then you'll get what I think you want. > > Maybe this will help: > > http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize > > though it there, I talked about Figure.savefig(). I don't know > if there is a difference between that and Figure.print_figure() > > -Chris >
This is not a matplotlib problem but an issue with Python itself. Unlike for example Tcl/Tk, Python does not have support for event loops. Each of the graphics backends (Tkinter, PyGTK, PyQT, the Mac OS X native backend) therefore each implement an event loop on their own. In general, these will clash with each other. Even IDLE's event loop (IDLE uses Tkinter) does not play nice with Tkinter itself: import Tkinter; Tkinter.Tk() opens a Tk window when run from the console, but does nothing when run from IDLE. Until Python itself supports event loops, I doubt that these problems will go away. I believe that ipython has made some progress in addressing these issues, but that of course won't help people who use regular python instead of ipython. --Michiel. --- On Fri, 2/5/10, David MacQuigg <mac...@ec...> wrote: > From: David MacQuigg <mac...@ec...> > Subject: [Matplotlib-users] Matplotlib conflicts with IDLE > To: mat...@li... > Date: Friday, February 5, 2010, 3:46 PM > > I can't get Matplotlib to work with IDLE. plt.show() > makes beutiful plots, > but IDLE is hung. Entering "exit" in the little > pop-up console window > raises an exception in IDLE, and then leaves the plot > window hung. It looks > like the old "dualing event loops" problem with IDLE, > although the > Matplotlib docs don't use that phrase. > > The way I ususally solve this is to use IDLE for editing my > scripts, and a > separate shell to actually run them. Here, I'm not > using a saved script. > This needs to work interactively, for students using Python > in a physics > class. I see that little console window, and it sure > looks like that was > intended to do what I need, but I can't find any > documentation on the > commands. How do I switch back and forth between IDLE > and the plot window > without leaving some process in limbo? Even better, > is there an option to > have the event loop automatically switch back to IDLE after > each update? > > I'm running on Mac OS-X, so it looks like IPython is not an > option. Also, I > would rather stick with IDLE. It is the perfect IDE > for non-CS students who > shouldn't be spending their time on the complexities of a > plotting package. > > -- > View this message in context: http://old.nabble.com/Matplotlib-conflicts-with-IDLE-tp27473693p27473693.html > Sent from the matplotlib - users mailing list archive at > Nabble.com. > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, > colocation > Stay online with enterprise data centers and the best > network in the business > Choose flexible plans and management services without > long-term contracts > Personal 24x7 support from experience hosting pros just a > phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
On Mon, Oct 6, 2008 at 10:56 AM, Eric Firing <ef...@ha...> wrote: > Christopher Barker wrote: > >> David Goldsmith wrote: >> >>> I feel like I must be missing something >>> >> >> yup -- though it's an understandable miss... >> > > I think the longstanding separation between the figure.dpi and the > savefig.dpi is a continual gotcha that we can and should eliminate. Savefig > should use the figure dpi, so that what is saved corresponds to what is on > the screen, unless explicitly overridden. One way to reduce the problem, > with what I hope is an adequate level of backwards compatibility, would be > to have the savefig.dpi default to a special flag setting that means "track > the figure.dpi". For example, savefig.dpi could be the string, 'screen', by > default. This could still be overridden by a numerical rcParams setting, or > by the explicit dpi kwarg setting in savefig() or print_figure(). > > There are still other highly confusing dpi things internally--such as a > renderer.dpi setting that is ignored during rendering. > > Comments? > This appears to have never been "fixed" (though I see no opposition expressed looking back at the original thread in the archive) - having forgotten about it and the fact that, at the time, it sent me running to PIL, I got bitten by it again (luckily I had a vague recollection of this thread before posting the same problem again and making a complete ass outta myself). I'm not sure if I have the bleeding edge version of MPL, but as I'm now working on the second different computer I've had since the OP, I'm pretty sure I'm running a later version than I was back then. Did this issue ever mature into a ticket? DG > > Eric > > > >> >> Attached are the results on my computer (see usage details below). >>> Granted, I'm increasing the resolution each iteration, >>> >> >> you are increasing the resolution of the figure, and of your calculations, >> but NOT of the output image. The hint was that every image was the same >> size: 1200X900 , which is 12"x9" at 100 dpi. >> >> It turns out that print_figure() doesn't respect the figures (native DPI), >> it defaults to 100 dpi, but you can override it: >> >> > canvas.print_figure("test"+str(DPI)+"dpi.png", dpi=DPI) >> >> Then you'll get what I think you want. >> >> Maybe this will help: >> >> http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize >> >> though it there, I talked about Figure.savefig(). I don't know if there is >> a difference between that and Figure.print_figure() >> >> -Chris >> >> >> > >
David MacQuigg wrote: > I can't get Matplotlib to work with IDLE. Sorry, I don't know anything about IDLE, but... > I'm running on Mac OS-X, so it looks like IPython is not an option. Why not? I use Ipython on OS-X all the time, and it is fabulous, really fabulous. > Also, I > would rather stick with IDLE. It is the perfect IDE for non-CS students who > shouldn't be spending their time on the complexities of a plotting package. Spyder: http://packages.python.org/spyder/ Looks really promising, but I don't think they've got OS-X packages yet. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no...
I can't get Matplotlib to work with IDLE. plt.show() makes beutiful plots, but IDLE is hung. Entering "exit" in the little pop-up console window raises an exception in IDLE, and then leaves the plot window hung. It looks like the old "dualing event loops" problem with IDLE, although the Matplotlib docs don't use that phrase. The way I ususally solve this is to use IDLE for editing my scripts, and a separate shell to actually run them. Here, I'm not using a saved script. This needs to work interactively, for students using Python in a physics class. I see that little console window, and it sure looks like that was intended to do what I need, but I can't find any documentation on the commands. How do I switch back and forth between IDLE and the plot window without leaving some process in limbo? Even better, is there an option to have the event loop automatically switch back to IDLE after each update? I'm running on Mac OS-X, so it looks like IPython is not an option. Also, I would rather stick with IDLE. It is the perfect IDE for non-CS students who shouldn't be spending their time on the complexities of a plotting package. -- View this message in context: http://old.nabble.com/Matplotlib-conflicts-with-IDLE-tp27473693p27473693.html Sent from the matplotlib - users mailing list archive at Nabble.com.
I'm working in IDLE in Win7. It seems to me it gets stuck in site-packages under C:\Python25. Maybe this is as simple as deleting the entry? Well, yes there's a MPL folder under site-packages and an info MPL file of 540 bytes. There are also pylab.py, pyc,and py0 files under site. What to do next? On 2/5/2010 7:13 AM, Wayne Watson wrote: > I should have installed numpy first, and got some errors installing > MPL. I don't see an uninstall in Control Panel Add/Rmv. > -- My life in two words. "Interrupted Projects." -- WTW (quote originator)
> On Fri, Feb 5, 2010 at 10:10 AM, Eymen Alyaz <ea...@mp...> > wrote: >> Is there a way to automatically correct the area of figure and resize it >> such that every box drawn is visible? > > If you're only interested in the saved ouput, you may use > "bbox_inches" option of "savefig". It does not change the size of the > figure currently displayed, but it does change the size of the figure > that is to be saved. Unfortunately, the released version of mpl will > not work. With svn version, you can do > ... Thank you for this quick reply. Your suggestion matched my intention of plotting/ saving the figure. I will give the svn version a shot and try it out. Regards, Eymen
On Fri, Feb 5, 2010 at 10:10 AM, Eymen Alyaz <ea...@mp...> wrote: > Is there a way to automatically correct the area of figure and resize it > such that every box drawn is visible? > Things like axes position is given in normalized figure coordinates, thus while you can change the figure size but it is quite hard to keep things in place. And, no, current mpl does not support that. If you're only interested in the saved ouput, you may use "bbox_inches" option of "savefig". It does not change the size of the figure currently displayed, but it does change the size of the figure that is to be saved. Unfortunately, the released version of mpl will not work. With svn version, you can do l = legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) savefig("a.eps", bbox_inches="tight", bbox_extra_artists=[l.legendPatch]) Regards, -JJ
I should have installed numpy first, and got some errors installing MPL. I don't see an uninstall in Control Panel Add/Rmv. -- My life in two words. "Interrupted Projects." -- WTW (quote originator)
Hello, please try this. from matplotlib.pyplot import * plot([1,2,3], label="very loooooooong label") plot([3,2,1], label="very loooooooong label2") legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) show() The code puts a legend with very long label text outside the figure. When drawing only the beginning of the legend is visible. Is there a way to automatically correct the area of figure and resize it such that every box drawn is visible? I know I can overcome this issue by using subplots. But this would only work to a certain extend of the problem. Regards Eymen
Once you have an axes object, you can call set_xlim() and set_ylim() on it to change the limits of the x- and y- axes respectively. You should be able to call that and savefig() iteratively to produce plots of different subsets of the same data. Let me know if you need more details, Mike On 02/05/2010 01:08 AM, David Carmean wrote: > Hi, > > I just emigrated from Ploticus last week :) Am working on a project where > I'm plotting the contents of a large .csv file with about 250,000 cells > (unix system 5-minute load averages from a set of 50 servers, for about > three weeks data now). > > I'm developing this in Spyder/Python(x,y)--completely unknown to me until > last week--and the pan/zoom capability makes me wish/wonder two things: > > 1: I wish I could interactively save the zoomed view to disk, and > > 2: This behavior hints at the possiblity of a better way to go back > and plot 15 1-day views of the original plot, than slicing up the > source array and re-plotting. > > > I'm .. so new to matplotlib/numpy that I'm sure I'm missing some > key concepts/terminology that, once identified, will let me find my > way to what I need to know. For example, I'm terribly confused right > now by Axes.get_axes(). > > Which classes/methods/examples/gallery examples should I look at? > > Thanks. > > > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
On 2/5/2010 12:51 AM, Wayne Watson wrote: > what I'm looking for is a way to draw a zig-zag path > indicating a path taken by a particle Here is a 2d example: >>> import numpy as np >>> import matplotlib.pyplot as plt >>> locs = np.random.random_sample((2,30)) >>> locs = np.random.random_sample((2,30)) - 0.5 >>> locs = np.cumsum(locs, axis=-1) >>> x,y = locs >>> plt.plot(x,y) hth, Alan Isaac
Wayne Watson wrote: > Simply explained what I'm looking for is a way to draw a zig-zag path > indicating a path taken by a particle. Maybe this is best done with some > tools outside of the normal plot capabilities? Why doesn't plot handle this? What do you see as missing? > > On 2/4/2010 9:02 PM, Wayne Watson wrote: >> Is there a difference between the two (Subject). Perhaps plot connects >> lines in the order of x? However, scatter does not connect any points? >> Yes, plot connects points in the order in which they appear in the input sequence; scatter does not connect, and has additional capabilities for varying the symbol, size, and color. Eric >
Hi, I just emigrated from Ploticus last week :) Am working on a project where I'm plotting the contents of a large .csv file with about 250,000 cells (unix system 5-minute load averages from a set of 50 servers, for about three weeks data now). I'm developing this in Spyder/Python(x,y)--completely unknown to me until last week--and the pan/zoom capability makes me wish/wonder two things: 1: I wish I could interactively save the zoomed view to disk, and 2: This behavior hints at the possiblity of a better way to go back and plot 15 1-day views of the original plot, than slicing up the source array and re-plotting. I'm .. so new to matplotlib/numpy that I'm sure I'm missing some key concepts/terminology that, once identified, will let me find my way to what I need to know. For example, I'm terribly confused right now by Axes.get_axes(). Which classes/methods/examples/gallery examples should I look at? Thanks.
Simply explained what I'm looking for is a way to draw a zig-zag path indicating a path taken by a particle. Maybe this is best done with some tools outside of the normal plot capabilities? On 2/4/2010 9:02 PM, Wayne Watson wrote: > Is there a difference between the two (Subject). Perhaps plot connects > lines in the order of x? However, scatter does not connect any points? > -- My life in two words. "Interrupted Projects." -- WTW (quote originator)
Is there a difference between the two (Subject). Perhaps plot connects lines in the order of x? However, scatter does not connect any points? -- My life in two words. "Interrupted Projects." -- WTW (quote originator)
I am terribly sorry, but it looks like all the indentation disappeared from the code. I'll try to attach the path file here. Best regards, Pavlo On Thu, Feb 4, 2010 at 16:19, Pavlo Shchelokovskyy <shc...@gm...> wrote: > Hi all, > I've got bored with the generic application icon in the wx backend so > I added the same icon as GTK backend uses (it is anyway bundled with > matplotlib). I have tested this on Windows (XP, Python 2.6.4, > matplotlib 0.99.1, wxPython 2.8.10.1) and on Linux (Fedora8, Python > 2.5.1, matplotlib 0.98.3, wxPython 0.8.9.1) > may be somebody from developers can integrate this patch into the source...
Hi all, I've got bored with the generic application icon in the wx backend so I added the same icon as GTK backend uses (it is anyway bundled with matplotlib). I have tested this on Windows (XP, Python 2.6.4, matplotlib 0.99.1, wxPython 2.8.10.1) and on Linux (Fedora8, Python 2.5.1, matplotlib 0.98.3, wxPython 0.8.9.1) may be somebody from developers can integrate this patch into the source... *** backend_wx.py 2010年02月04日 13:17:59.954259000 +0100 --- backend_wx.py 2010年02月04日 16:00:45.251283000 +0100 *************** *** 1454,1460 **** self.figmgr = FigureManagerWx(self.canvas, num, self) bind(self, wx.EVT_CLOSE, self._onClose) ! def _get_toolbar(self, statbar): if matplotlib.rcParams['toolbar']=='classic': toolbar = NavigationToolbarWx(self.canvas, True) --- 1454,1473 ---- self.figmgr = FigureManagerWx(self.canvas, num, self) bind(self, wx.EVT_CLOSE, self._onClose) ! ! # setting window icon to replace the generic one ! self.SetIcon(self._load_icon()) ! ! def _load_icon(self): ! # since wxPython does not support SVG, only PNG image is used ! icon = wx.IconFromBitmap(_load_bitmap('matplotlib.png')) ! # on Windows wxPython can not use one icon size for all sizes, ! # with only exception of 32px -> 16px auto conversion ! if wx.Platform == '__WXMSW__': ! icon.SetHeight(32) ! icon.SetWidth(32) ! return icon ! def _get_toolbar(self, statbar): if matplotlib.rcParams['toolbar']=='classic': toolbar = NavigationToolbarWx(self.canvas, True)
Hello! I'm writing an application that will show different plots on it's GUI. In order to switch between the different plot types I'd like to destroy the first plot and to create a new afterwards. I stumbled into a memory leak since I don't know how to close matplotlib figures the clean way. I wrote a small test programm. Pressing the button 'create' creates a figure and 'delete' should destroy it. Since the graph class is derived from the Tix.Frame class I would expect that destroying the Frame would also remove all matplot stuff. But when I do not implement my own destroy() method in the graph class, destroying the Frame shows absolutely no effect. The plot simply stays on the screen. When I overload the Tix.Frame.destroy() method with my own implementation, as shown below, the plot disappears but not all memory is being released. When creating and deleting figures, the amount of memory python needs is constantly growing and python eventually crashes. I tried to find a solution on the internet but I found nothing really helpful so far. All examples I found just display something and then just exit. I appreciate any help! -------------- import matplotlib matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib.figure import Figure import Tix import sys def destroy(e): sys.exit() root = Tix.Tk() class graph(Tix.Frame): def __init__(self, master, **kw): Tix.Frame.__init__(self, master, **kw) self.f = Figure(figsize=(5,4), dpi=100) self.a = self.f.add_subplot(111) t = arange(0.0,3.0,0.01) s = sin(2*pi*t) self.a.plot(t,s) self.canvas = FigureCanvasTkAgg(self.f, master=self.master) self.canvas.show() self.canvas.get_tk_widget().pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) self.toolbar = NavigationToolbar2TkAgg(self.canvas, root ) self.toolbar.update() self.canvas._tkcanvas.pack(side=Tix.TOP, fill=Tix.BOTH, expand=1) def destroy(self): Tix.Frame.destroy(self) self.toolbar.destroy() self.canvas._tkcanvas.destroy() class ui(Tix.Frame): g = None def __init__(self, master, **kw): Tix.Frame.__init__(self, master, **kw) self.b = Tix.Button(self, text='create', command=self.create) self.b.pack() self.b2 = Tix.Button(self, text='delete', command=self.delete) self.b2.pack() def delete(self): try: self.g.destroy() except: pass def create(self): self.delete() self.g = graph(root) ui(root).pack() root.mainloop() -- View this message in context: http://old.nabble.com/Memory-leak-when-destroying-Tk-frame-containing-a-figure-tp27452209p27452209.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Wed, 2010年02月03日 at 22:04 -0800, Michael Cohen wrote: > > One of the most persistent problems I have with matplotlib is finding > > out which kwargs and args are available for some commands. > > For instance, I am looking at manipulating axis ticks and labels in > > mplot3d, so I went to the mplot3d api page, and looked for useful > > commands and found: > > > > set_xlabel(xlabel, fontdict=None, **kwargs)¶ > > Set xlabel. > > > > set_xlim3d(*args, **kwargs)¶ > > Set 3D x limits. > > > > However, there is no information that I can find about "args" and > > "kwargs" that I can use to figure out how to make my changes. Don't these unbound methods just take the same arguments as the bound methods "xlabels" and "xlim", as given in http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xlabel and http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.xlim ?
Hi, your problem is that you enter the X values in an unordered way? Then, you just have to sort the key-value-pairs before plotting. One way it works is to create a dict in the form "d = {x1: y1,x2:y2}" (with a for loop and so on), then extract the keys: k = d.keys() k.sort() v = [d[key] for key in k] ... now plot(k,v) Maybe there is a simpler solution, but this one works. Regards, Philipp
Hi, > If I select the x in > the upper right, it dies badly. This is maybe another problem, after closing the windows the program should exit with exitcode 0. -------------------------- # -*- coding: utf-8 -*- from pylab import * t = linspace(0,10,100) plot(t, sin(t)) show() -------------------------- If the problem occurs with the example above it would help if you paste the error message and the exit code. Regards, Philipp