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
(5) |
2
(17) |
3
(13) |
4
(17) |
5
(26) |
6
(13) |
7
(9) |
8
(8) |
9
(13) |
10
(25) |
11
(19) |
12
(24) |
13
(12) |
14
|
15
|
16
(5) |
17
(10) |
18
(7) |
19
|
20
(7) |
21
(2) |
22
(3) |
23
(11) |
24
(19) |
25
(17) |
26
(6) |
27
(10) |
28
(2) |
29
(4) |
30
(15) |
|
|
|
|
|
Thanks Jeff, that does what I want. It seems to be efficient, as long as you don't try to plot 10.000+ values on a small map (results in a colored rectangle anyway...). After thinning out my data data = data.compress(maskX, axis=1) data = data.compress(maskY, axis=0) it seems to be only a little bit slower than contour / contourf. Simon Jeff Whitaker schrieb: > Simon Kammerer wrote: >> Hi list, >> >> what's the best (meaning most efficient/fastest) way to plot grid >> point values on a map created with basemap? >> >> I'd like to plot the raw values of my data-array to the correspondig >> gridpoints, instead of having it transformed to something like contour >> or contourf. The ne plus ultra would be the ability to assing a >> colormap, to control the font color of the plotted values... >> >> Regards >> Simon >> >> > > Simon: I don't know about efficiency, but this does what you want: > > from pylab import show, title, arange, figure, title, arccos, pi, cm, > text, sqrt > import random > from matplotlib.colors import rgb2hex > from matplotlib.toolkits.basemap import Basemap > from matplotlib.numerix.random_array import uniform > > # Plot a bunch of randomly distributed points on the earth. > > # set up stereographic map centered on N. Pole. > m = Basemap(lon_0=-105,boundinglat=30.,resolution='l', > area_thresh=10000.,projection='npstere') > # number of points to plot. > npts = 300 > # generate random points on a sphere, > # so that every small area on the sphere is expected > # to have the same number of points. > # http://mathworld.wolfram.com/SpherePointPicking.html > try: # this works for numpy > u = uniform(0.,1.,size=npts) > v = uniform(0.,1.,size=npts) > z = uniform(0,100,size=npts) > except: # this works for Numeric/numarray > u = uniform(0.,1.,shape=npts) > v = uniform(0.,1.,shape=npts) > z = uniform(0,100,shape=npts) > lons = 360.*u > lats = (180./pi)*arccos(2*v-1) - 90. > # transform lons and lats to map coordinates. > x,y = m(lons,lats) > # create a list of strings containing z values > zn = [ '%2i' % zz for zz in z ] > # plot numbers on map, colored by value. > vmin = 0; vmax = 100 > cmap = cm.jet # use 'jet' colormap > for name,zval,xpt,ypt in zip(zn,z,x,y): > # only plot values inside map region. > if xpt > m.xmin and xpt < m.xmax and ypt > m.ymin and ypt < m.ymax: > rgbcolor = cmap(1.-(zval-vmin)/(vmax-vmin))[:3] > hexcolor = rgb2hex(rgbcolor) > text(xpt,ypt,name,fontsize=9,weight='bold',color=hexcolor) > # draw coasts and fill continents. > m.drawcoastlines(linewidth=0.5) > m.fillcontinents() > # draw parallels and meridians. > delat = 20. > circles = arange(0.,90.,delat).tolist()+\ > arange(-delat,-90,-delat).tolist() > m.drawparallels(circles) > delon = 45. > meridians = arange(0,360,delon) > m.drawmeridians(meridians,labels=[1,1,1,1]) > title('Random Data Value at Random Points',y=1.075) > show() > > > HTH, > > -Jeff > > > ------------------------------------------------------------------------ >
Hi Giorgio, Had a quick look at pylab based scripts and got an error on backend_tkagg when py2exe it. It looks like one needs to force the backend to be included, I used tkagg but you would have to replace that with wxagg for your script. Attached is a setup.py and from the examples the file simple_plot.py. Werner
Giorgio Luciano ha scritto: > At first I thought ... hey why people wat an interface, just use the > console, and then after listening to their reason I have to agree. > What do I generally do ? I have a matrix in txt, I apply my routines (a > SVD, a PCA, a filter etc etc written in python), plot them (using > maplotlib) and then I want an output. that's it. > I started looking at various Qt etc. etc. but for me it's overhelming, > because I think that the most important part should be dedicate to the > routines creation and not to making a gui, compiling, etc. etc. I need > simple command like people wants. grids, paste and copy, small working > plots :) > I mean I can get crazy with setting my program, importing etc. etc. but > I also have to say that needs and claim about writing simple guis, > common paste and copy etc should be considered from someone there (we > wait for the help of some guru that makes things easier ;) It's quite hard for me to understand what you mean. Anyway, I solved the issue of usability vs code simplicity for my data analysis application by using a mixed CLI+GUI design. That is, I have a very simple GUI that just shows the plot and may have some button/menu for basic operations, and a custom command line to finely work with it. Think of RasMol, for example. The custom command line is done with the Python Cmd module that is included with Python, and it's a breeze to code with. The GUI uses Matplotlib embedded with wxMPL in a wxPython frame. The command line and the GUI are threaded (work on two different threads) that communicate by passing events (cli-->gui) and with a Queue (gui-->cli): easy. Anyway, I'd advice you to learn wxPython basics. It's powerful, free, multiplatform and it's becoming the default Python GUI toolkit in the wild. Learning a GUI toolkit cannot harm. If you can, buy the Robin Dunn book "wxPython in Action", it's wonderful to say the least. m. -- Massimo Sandal University of Bologna Department of Biochemistry "G.Moruzzi" snail mail: Via Irnerio 48, 40126 Bologna, Italy email: mas...@un... tel: +39-051-2094388 fax: +39-051-2094387
Hi Giorgio, Giorgio Luciano wrote: > Hello Werner, > and thank for the reply I've tried to recompile everything. The file > you sent in the mailing list give me the problem of wxmsw26uh_vc.dll > (and also dll missing while compiling) For the wxmsw26uh_vc.dll you need to rename the .pyd file as mentioned in the response to Daniel before you py2exe it. The error output you get when running py2exe is normal, it just tells you that there are files not included by py2exe. You need to decide if you need them, if you have the right to distribute them etc and then either include them with your installer or add them to the package include option for py2exe. > but then it runs > when I try to compile my file (nipals) it doesnt' start and give me as > error Sorry, I don't understand why you get the error about backends, but I can't run your nipals.py as it contains/uses modules I don't have. I'll see if I can do a setup.py for a simple matplotlib file using pylab. Werner
Hi Daniel, Daniel Stalder wrote: > Hello > > I saw your thread and I have a related problem. > I use matplotlib (0.90.0.win32-py2.5) with wxPython > (2.8-win32-unicode-2.8.3.0-py25). > I use matplotlib with WXAgg and got the following error msg: > "This application has failed to start because wxmsw26uh_vc.dll was not > found. Re-installing the application may fix this problem." > Re-install will not help. The problem is that matplotlib is compiled/linked against wxPython 2.6 Unicode. A work around Andrea Gavana found is to do the following rename, before you py2exe the app. matplotlib/backends/_wxagg.pyd to matplotlib/backends/_wxagg not used.pyd Werner
Hello I saw your thread and I have a related problem. I use matplotlib (0.90.0.win32-py2.5) with wxPython (2.8-win32-unicode-2.8.3.0-py25). I use matplotlib with WXAgg and got the following error msg: "This application has failed to start because wxmsw26uh_vc.dll was not found. Re-installing the application may fix this problem." The error msg appears on "import _wxagg" in the file backend_wxagg.py # try to load the WXAgg accelerator try: import _wxagg >>> the msg appears here except ImportError: _wxagg = None I already had this problem with previous versions of both libraries. Thanks for any help Daniel -----Original Message----- From: Werner F. Bruhin [mailto:wer...@fr...] Sent: Wednesday, 4 April 2007 2:58 a.m. To: lu...@di...; matplot Subject: Re: [Matplotlib-users] matplotlib and py2exe Hi Giorgio, Giorgio Luciano wrote: > Hello Werner, > here is the file I try to compile. > It gave an error of missing DLL when i try to launch :( > no Idea why, since with you example everything works > (I'm using maplotlib 0.87.7) I assume the DLL not found is "wxmsw26uh_vc.dll" at least I believe that 87.7 is already compiled against wxPython 2.6 Unicode (hopefully this dependency will go away with some future release of matplotlib), so you need to either use the Unicode version of wxPython 2.6 or do the following as mentioned earlier in this thread. matplotlib/backends/_wxagg.pyd to matplotlib/backends/_wxagg not used.pyd If it is another .dll missing it would help if you let us know the name and the exact exception. Werner ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. This electronic transmission and any documents accompanying this electronic transmission contain confidential information belonging to the sender. This information may be legally privileged. The information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on or regarding the contents of this electronically transmitted information is strictly prohibited. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Hi there, A few months back, I complained about the slowness of the image function in matplotlib. One of the cullprit was a slow clip function; I've done a bit some work to improve the situation on numpy's side, efforts which were integrated in numpy 1.0.2. Now, when you clip a numpy array with scalar min and max values, you get a 5 to 30 fold speed-up; to get the maximum efficiency, you need inplace clipping (using the syntax a.clip(min, max, a) for a a numpy array). This makes image significantly faster (between 100 and 200 ms on recent computers), and I am sure in other functionalities of matplotlib as well. cheers, David
Hi Giorgio, Giorgio Luciano wrote: > Hello Werner, > here is the file I try to compile. > It gave an error of missing DLL when i try to launch :( > no Idea why, since with you example everything works > (I'm using maplotlib 0.87.7) I assume the DLL not found is "wxmsw26uh_vc.dll" at least I believe that 87.7 is already compiled against wxPython 2.6 Unicode (hopefully this dependency will go away with some future release of matplotlib), so you need to either use the Unicode version of wxPython 2.6 or do the following as mentioned earlier in this thread. matplotlib/backends/_wxagg.pyd to matplotlib/backends/_wxagg not used.pyd If it is another .dll missing it would help if you let us know the name and the exact exception. Werner
I've had similar problems running wxPython code under certain IDEs where things can go very poorly (dramatic crashing, or it just wont execute). At least with the wx or wxagg backends, I have no trouble running matplotlib demos such as "ellipse_demo.py" from inside eclipse+pydev. -tim Gary Ruben wrote: > I have to agree with Giorgio in general. Unfortunately, the threading > support required by matplotlib isn't implemented in pyScripter, which > means that it's a nice environment until you want to do some plotting, > when it becomes a bit flaky. I haven't checked eclipse's behaviour with > matplotlib. > > Gary R. > > Giorgio F. Gilestro wrote: > >> A really great IDE for windows users is pyScripter ( >> http://mmm-experts.com/Products.aspx?ProductId=4 ) >> It's probably the best I could try so far (and it's free). >> >> cheers >> >> On 3/30/07, Tim Hirzel <hi...@re...> wrote: >> >>> As for a good IDE. I really like eclipse with pydev. For easy >>> student/beginner setup, easyclipse has a nice python eclipse distribution >>> >>> http://www.easyeclipse.org/site/distributions/index.html >>> >>> I think I've tried near every python IDE setup out there over the last >>> couple years, and this one wins for me. >>> >>> tim >>> > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > >
Eric, Not much progress, I think. Memory leaks seem endemic to the gui backends, although Tk is by far the worst. I have been trying to understand the gtk case in the hope of discovering some simple change in mpl code that might eliminate the problem there and turn out to be applicable to the other backends as well. But I have not found the source of the problem, and it seems to occur even in a very simple test gui script using pure pygtk, with no mpl. I need to do more testing to find out whether the gtk problem is specific to use of gtk.Toolbar, or whether it will occur with any nested widgets. It seems that widgets are not getting destroyed completely; maybe there are some references lurking somewhere in the dark. With gtk, the garbage collector does not find any cycles that it can't deal with, but if I remember correctly from earlier testing, this is not the case with Tk. As a partial workaround, if you don't need the toolbar, try setting rcParams['toolbar'] = None This may make the leak much smaller. I think the toolbar causes problems in all guis simply because it increases the complexity and number of widgets being tracked, if for no other reason. I would be delighted if a gui guru would emerge with a thorough explanation and solution for the memory leaks occurring with repeated opening and closing of windows. Eric Pellegrini Eric wrote: > Hi evebrybody, > > I started a discussion one week ago about a problem of memory leak using > the following code: > > ******************************************************************************** > from Tkinter import * > from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg > import pylab > > def display(): > mat = pylab.zeros((100,100)) > pylab.ioff() > image = pylab.matshow(mat) > pylab.ion() > pylab.close() > can = FigureCanvasTkAgg(image, master=frame) > can.show() > can.get_tk_widget().grid(row = 0,column = 0) > > root = Tk() > frame = Frame(root) > frame.grid(row = 0,column = 0) > canvas = Canvas(frame, width = 240, height = 240, relief = "sunken", bg > = "white") > canvas.grid() > button = Button(root,text="DisplayMatrix",command = display) > button.grid(row = 1,column = 0) > ******************************************************************************* > > up to now, I have not found any way to solve it and unfortunately the > proposed hints did not solve the problem (gc_collect(), clf(), cla()). > Is there something new about this ? > > thanks > > Eric > > ------------------------------------------------------------------------ > Découvrez une nouvelle façon d'obtenir des réponses à toutes vos > questions ! Profitez des connaissances, des opinions et des expériences > des internautes sur Yahoo! Questions/Réponses > <http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com>. > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
First, Please don't cross-post quite so much. I've only sent this to the matplotlib list. Maybe the scipy-users would be better, but I'm not on that one. First: What you want to do really is hard. One of the reasons is that each app is going to have its own "simple" needs. Also, GUIS really do take a lot of work. I've written simple command line scripts, then found wrapping a GUI around them takes three times as long to write as the scripts took in the first place. Yes, it could be easier, but it's always going to be a lot of work. Second: Matlab is an expensive, proprietary application, thus, if you don't build a stand-alone, your users need to buy Matlab to use your code. Python/scipy/numpy/mpl are all freely re-distributable, so you don't' have that problem. Maybe your users don't really need a stand-alone, but rather need an easy to install and use environment for running your code, command line and all. Granted, there is no such complete package available at this point but there are efforts to make then, and you could also build your own. The Enthought build is good for Windows. Also be sure to check out qme-dev: http://sourceforge.net/projects/qme-dev/ It's not complete yet, but looks pretty promising. There are also efforts afoot to make it a bit easier to use py2exe, py2app, etc. for building stand-alones. If you really do want to build a stand-alone GUI tool, there are a lot of ways to make really full-featured GUIs, though you're right, it takes quite a bit of work. Given the state of affairs right now, I'd take a look at Dabo (it's not just for database apps): http://dabodev.com/ or PythonCard http://pythoncard.sourceforge.net/ And figure out how to integrate MPL with them (probably with wxMPL). Both of these projects seek to make it easier to build GUIs with wxPython, which I think is the best choice for cross-platform GUIs. Dabo, in particular, is oriented toward data-aware widgets, which could be a very good match for small scientific computation tools. -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...
On Apr 1, 2007, at 11:27 PM, Chelonian wrote: > > I'm new to matplotlib, and I can't even get this to work (let alone > the > other fix of changing the colors). Could you elaborate about how to > implement this? I've tried putting these lines in the __init__ of the > PlotPanel() class, but I can't get it. Any help is appreciated, > thank you. It sounds like you're using WxMpl to embed matplotlib in something. If that's the case, you should look at the example code below. Otherwise, please send a short example script to the list. Also, please note that disabling the frame effectively makes the figure's background transparent when using the WXAgg backend. I'm not sure if this is the intended behavior. If that's not what you want, you can probably just set the Figure's face and edge colors to the same thing using Figure.set_edgecolor() and Figure.set_facecolor(). Ken import wxmpl import wx class MyPlotPanel(wxmpl.PlotPanel): def __init__(self, parent, id, **kwds): wxmpl.PlotPanel.__init__(self, parent, id, **kwds) fig = self.get_figure() fig.set_frameon(False) if __name__ == '__main__': app = wx.PySimpleApp() frame = wx.Frame(None, -1, 'Frame Off') panel = MyPlotPanel(frame, -1) szr = wx.BoxSizer(wx.VERTICAL) szr.Add(panel, 1, wx.EXPAND|wx.ALL, 5) frame.SetSizer(szr) frame.Fit() axes = panel.get_figure().gca() axes.plot([0,1,2,3,4,5]) frame.Show(True) app.MainLoop()
Hi, I want to animate a scatter plot using the pylab interface. Something like this: ion() s=3Dscatter(x,y,s,c) for i in range (10): #update data s.draw() s is a RegularPolyCollection and thuse does not have a set_data method. How am I supposed to update the data so that I can modify the plot? --=20 Fl=E1vio Code=E7o Coelho registered Linux user # 386432 get counted at http://counter.li.org --------------------------- "software gets slower faster than hardware gets faster" Niklaus Wirth's law
Simon Kammerer wrote: > Hi list, > > what's the best (meaning most efficient/fastest) way to plot grid > point values on a map created with basemap? > > I'd like to plot the raw values of my data-array to the correspondig > gridpoints, instead of having it transformed to something like contour > or contourf. The ne plus ultra would be the ability to assing a > colormap, to control the font color of the plotted values... > > Regards > Simon > > Simon: I don't know about efficiency, but this does what you want: from pylab import show, title, arange, figure, title, arccos, pi, cm, text, sqrt from matplotlib.colors import rgb2hex from matplotlib.toolkits.basemap import Basemap from matplotlib.numerix.random_array import uniform # Plot a bunch of randomly distributed points on the earth. # set up stereographic map centered on N. Pole. m = Basemap(lon_0=-105,boundinglat=30.,resolution='l', area_thresh=10000.,projection='npstere') # number of points to plot. npts = 300 # generate random points on a sphere, # so that every small area on the sphere is expected # to have the same number of points. # http://mathworld.wolfram.com/SpherePointPicking.html try: # this works for numpy u = uniform(0.,1.,size=npts) v = uniform(0.,1.,size=npts) z = uniform(0,100,size=npts) except: # this works for Numeric/numarray u = uniform(0.,1.,shape=npts) v = uniform(0.,1.,shape=npts) z = uniform(0,100,shape=npts) lons = 360.*u lats = (180./pi)*arccos(2*v-1) - 90. # transform lons and lats to map coordinates. x,y = m(lons,lats) # create a list of strings containing z values zn = [ '%2i' % zz for zz in z ] # plot numbers on map, colored by value. vmin = 0; vmax = 100 cmap = cm.jet # use 'jet' colormap for name,zval,xpt,ypt in zip(zn,z,x,y): # only plot values inside map region. if xpt > m.xmin and xpt < m.xmax and ypt > m.ymin and ypt < m.ymax: rgbcolor = cmap(1.-(zval-vmin)/(vmax-vmin))[:3] hexcolor = rgb2hex(rgbcolor) text(xpt,ypt,name,fontsize=9,weight='bold',color=hexcolor) # draw coasts and fill continents. m.drawcoastlines(linewidth=0.5) m.fillcontinents() # draw parallels and meridians. delat = 20. circles = arange(0.,90.,delat).tolist()+\ arange(-delat,-90,-delat).tolist() m.drawparallels(circles) delon = 45. meridians = arange(0,360,delon) m.drawmeridians(meridians,labels=[1,1,1,1]) title('Random Data Value at Random Points',y=1.075) show() HTH, -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 S
I have to agree with Giorgio in general. Unfortunately, the threading support required by matplotlib isn't implemented in pyScripter, which means that it's a nice environment until you want to do some plotting, when it becomes a bit flaky. I haven't checked eclipse's behaviour with matplotlib. Gary R. Giorgio F. Gilestro wrote: > A really great IDE for windows users is pyScripter ( > http://mmm-experts.com/Products.aspx?ProductId=4 ) > It's probably the best I could try so far (and it's free). > > cheers > > On 3/30/07, Tim Hirzel <hi...@re...> wrote: >> As for a good IDE. I really like eclipse with pydev. For easy >> student/beginner setup, easyclipse has a nice python eclipse distribution >> >> http://www.easyeclipse.org/site/distributions/index.html >> >> I think I've tried near every python IDE setup out there over the last >> couple years, and this one wins for me. >> >> tim
Hi evebrybody, I started a discussion one week ago about a problem of memory leak using the following code: ******************************************************************************** from Tkinter import * from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import pylab def display(): mat = pylab.zeros((100,100)) pylab.ioff() image = pylab.matshow(mat) pylab.ion() pylab.close() can = FigureCanvasTkAgg(image, master=frame) can.show() can.get_tk_widget().grid(row = 0,column = 0) root = Tk() frame = Frame(root) frame.grid(row = 0,column = 0) canvas = Canvas(frame, width = 240, height = 240, relief = "sunken", bg = "white") canvas.grid() button = Button(root,text="DisplayMatrix",command = display) button.grid(row = 1,column = 0) ******************************************************************************* up to now, I have not found any way to solve it and unfortunately the proposed hints did not solve the problem (gc_collect(), clf(), cla()). Is there something new about this ? thanks Eric --------------------------------- Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
Hello Dear All, I just have a question for all that uses python/numpy/scipy/matplotlib for making science. I use with no problem in my computer python+numpy+scipy+matplotlib and I'm very satisfied with them. I was a matlab user. I still not have unearthed the power ot python but I'm happy to use a programming language and not a metalanguage. When I gave people my software (in matlab) the all ask me if I could compile and create some interface. I tried to use matlab GUIs, succeded in creating, but then I had a lot of problems. Compiling not always worked. after compiling you have not a workspace and so I had to make all output as txt files... and so on. Now that I use python I'm again with the same problem. I create easy routines (for chemometrics) and then people ask me if I can make a standalone program with interface. I used orange and for NN it's surely one of the best, but I'm not good at programming widgets. Then I think about it, searched the web and didn't find anything. What I'm searching is something similar to labview :) At first I thought ... hey why people wat an interface, just use the console, and then after listening to their reason I have to agree. What do I generally do ? I have a matrix in txt, I apply my routines (a SVD, a PCA, a filter etc etc written in python), plot them (using maplotlib) and then I want an output. that's it. I started looking at various Qt etc. etc. but for me it's overhelming, because I think that the most important part should be dedicate to the routines creation and not to making a gui, compiling, etc. etc. I need simple command like people wants. grids, paste and copy, small working plots :) I mean I can get crazy with setting my program, importing etc. etc. but I also have to say that needs and claim about writing simple guis, common paste and copy etc should be considered from someone there (we wait for the help of some guru that makes things easier ;) thanks for reading the mail Giorgio
Hello Werner, here is the file I try to compile. It gave an error of missing DLL when i try to launch :( no Idea why, since with you example everything works (I'm using maplotlib 0.87.7) Giorgio ------------------------------------------------------------------------ import pylab as pyl from scipy import * from pyautosct import * x=pyl.load('c:/temp/iris.txt') #def pynipals #return (lmat,smat,qcont,tcont,smat2,qcont2,tcont2) [o,c]=x.shape aut=raw_input('Autoscale data [y] or [n] ?') # Start of autoscaling if aut=='y': vard=var(x,axis=0)*(o/(o-1.0)) stdn=sqrt(vard)# it differs from std in Matlab(tm) where std is normalised stdon=ones((o,1))*stdn xmeann=ones((o,1))*x.mean(axis=0) xnorm=(x-xmeann)/stdon x=xnorm # End of autoscaling smat=zeros((o,c)) lmat=zeros((c,c)) xt=x if o>c: vp=zeros((1,o)) varexp=zeros((1,o)) else: vp=zeros((1,c)) varexp=zeros((1,c)) t=0 vartot=(x**2).sum() sts=raw_input('Variance to be retained (max 99) ?') st=int(sts) st=round(st,1) while vp.sum()<st: t=t+1 ss=(x**2).sum(axis=0) #ss=round_(ss, decimals=8) a=sort(ss) b=ss.argsort(kind='merge') xmax=xt[:,b[c-1]] s=(xmax*xmax).sum() diffi=1000 while diffi>0.0000001: rmax=dot(xmax,xt)/s rmaxsq=(rmax*rmax).sum() rmax=rmax/sqrt(rmaxsq) xmax=dot(xt,rmax) s2=(xmax*xmax).sum() diffi=abs(s2-s) s=s2 smat[:,t-1]=xmax lmat[t-1,:]=rmax varexp[0,t-1]=(xmax*xmax).sum() vp[0,t-1]=varexp[0,t-1]/vartot*100 xmaxc=xmax[:,pyl.NewAxis] xt=xt-xmaxc*rmax print vp print diffi ncs=raw_input('How many components ?') nc=int(ncs) lmat=lmat[arange(0,nc),:] smat=smat[:,arange(0,nc)] [a,b]=smat.shape ##### Computation of T2 values t2=zeros((o,1)) vvv=zeros((nc,nc)) for i in arange(1,nc+1): vvv[i-1,i-1]=varexp[0,i-1]/(o-1) for i in arange(1,o+1): t2[i-1]= dot(dot(smat[i-1,arange(0,nc)],linalg.inv(vvv)),smat[i-1,arange(0,nc)]) ### T2 contributions ssq=empty((nc,1)) for i in arange(1,nc+1): ssq[i-1,0]=vvv[i-1,i-1] h=(1./sqrt(ssq)) k=h[:,0] #it has to be a vector before using diag tcont=dot(dot(dot(x,lmat.transpose()),diag((k))),lmat) #Comparison with matlab -= ok =- # Computation of Q values based on cross-validation (ng deletion groups) ng=5; q=zeros((o,1)) qcont=zeros((o,c)) for g in arange(1,ng+1): t=arange(g,o+1,ng) smattr=zeros((o,c)) lmattr=zeros((c,c)) xtr=x; xtr=delete(xtr,t-1, axis=0) xev=x[t-1,:] [rtr,c]=xtr.shape if aut=='y': sst=diag(ones((rtr,1))*std(xtr,axis=0)*sqrt((rtr/(rtr-1.0)))) jj1=min(sst) jj2=argmin(sst) if jj1==0: print 'Error: variable ', int(jj2), ' constant in group ', int(g) aa=pyautosct(xtr,xev) xtr=aa[arange(0,rtr),:] [aah,aak]=aa.shape xev=aa[arange(rtr,size(aa,0)),:] #Comparison with matlab -= ok =- xttr=xtr [ttrh,ttrk]=xttr.shape tt=0 ##checked while tt<nc: smattr=zeros((ttrh,nc)) lmattr=zeros((nc,c)) tt=tt+1 ss=(xttr**2).sum(axis=0) a2=sort(ss) b2=ss.argsort(kind='merge') xmax=xttr[:,b2[c-1]] s=(xmax*xmax).sum() ##checked diffi=1000 while diffi>0.0000001: rmax=dot(xmax,xttr)/s rmaxsq=(rmax*rmax).sum() rmax=rmax/sqrt(rmaxsq) xmax=dot(xttr,rmax) s2=(xmax*xmax).sum() diffi=abs(s2-s) s=s2 ##checked smattr[:,tt-1]=xmax lmattr[tt-1,:]=rmax xmaxc=xmax[:,pyl.NewAxis] xttr=xttr-xmaxc*rmax smatev=dot(xev,lmattr.transpose()) reconstrev=dot(smatev,lmattr) for i in arange(1,size(xev,0)+1): tind=t-1 q[tind[i-1]]=((reconstrev[i-1,:]-xev[i-1,:])*(reconstrev[i-1,:]-xev[i-1,:])).sum() qcont[tind[i-1]]=(reconstrev[i-1,:]-xev[i-1,:])**2 print 'smat' print smat print 'lmat' print lmat print 'tcont' print tcont print 'qcont' print qcont
I tried to compile the file and it seems to work (send by Werner). I'm also interested in the problem since I cannot succeed in compiling too with matplotlib (already followed the instruction found on py2exe) Hope to see how it develop and happy to know if anyone succeed in doing it Giorgio >
I think the problems with imshow and matshow of integer arrays are fixed now in svn. Eric Suresh Pillai wrote: > So I been using the log scale provided by matplotlib.colors.LogNorm, but > have been seing bizarre behaviour. Basically, high values are not > displayed properly. I give simple examples below with just two possible > values in the matrix, but all the same issues arise with more varied > values. > > First notice that the high value (100000) is displayed as being of > value=1: > > from pylab import * > from matplotlib.colors import LogNorm > > matrix = ones((30,30)) > matrix = matrix*440 > matrix[29,29] = 100000 > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > colorbar() > show() > > The cutoff value for incorrect display (for the scale I am using) seems to > be at 32000: > > from pylab import * > from matplotlib.colors import LogNorm > > matrix = ones((30,30)) > matrix = matrix*440 > matrix[29,29] = 32000 > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > colorbar() > show() > > However, if the value is really high, the color displayed changes again, > although still not to the correct color (please try with values 918000, > 920000, and 999000 to see see it progress): > > from pylab import * > from matplotlib.colors import LogNorm > > matrix = ones((30,30)) > matrix = matrix*440 > matrix[29,29] = 918000 > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > colorbar() > show() > > And if one specifies no limits to LogNorm, the colorbar displayed is > incomplete and the colour displayed is wrong in a different way then when > specifying the limits (try value = 999000 as well). > > from pylab import * > from matplotlib.colors import LogNorm > > matrix = ones((30,30)) > matrix = matrix*440 > matrix[29,29] = 918000 > > matshow(matrix, norm=LogNorm()) > colorbar() > show() > > > Either I am completely missing something or there is a major bug. > > I am using mpl checked out from svn on 26 March. > > Thanks, > Suresh > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hi list, what's the best (meaning most efficient/fastest) way to plot grid point values on a map created with basemap? I'd like to plot the raw values of my data-array to the correspondig gridpoints, instead of having it transformed to something like contour or contourf. The ne plus ultra would be the ability to assing a colormap, to control the font color of the plotted values... Regards Simon
Suresh Pillai wrote: > Thanks. Suspected as much re integer vs float. > > Which brings me to the question: if we are able to debug issues > ourselves, should we just post to this list or the devel list or > contribute privately. Definitely to one of the lists. If you think other users may be interested in the bug, or may have seen it and may have a solution, then post to the users list. I expect this will usually be the case. But (for example) if you see something in the code that you think should be done differently, but is not causing immediate problems, then you might want to post that the the devel list instead, on the grounds that it would not be of interest to users who are not also devel subscribers. Eric > > Thanks, > Suresh
Thanks. Suspected as much re integer vs float. Which brings me to the question: if we are able to debug issues ourselves, should we just post to this list or the devel list or contribute privately. Thanks, Suresh On Mon, 2 Apr 2007, Eric Firing wrote: > I see where the problem (or at least one problem) is, and I will try to get > it fixed by tomorrow. In the meantime, I think you will get the results you > want by simply converting your arrays to floating point: > > matshow(matrix.astype(float), ...) > > Eric > > Suresh Pillai wrote: > > So I been using the log scale provided by matplotlib.colors.LogNorm, but > > have been seing bizarre behaviour. Basically, high values are not > > displayed properly. I give simple examples below with just two possible > > values in the matrix, but all the same issues arise with more varied > > values. > > > > First notice that the high value (100000) is displayed as being of > > value=1: > > > > from pylab import * > > from matplotlib.colors import LogNorm > > > > matrix = ones((30,30)) > > matrix = matrix*440 > > matrix[29,29] = 100000 > > > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > > colorbar() > > show() > > > > The cutoff value for incorrect display (for the scale I am using) seems > > to > > be at 32000: > > > > from pylab import * > > from matplotlib.colors import LogNorm > > > > matrix = ones((30,30)) > > matrix = matrix*440 > > matrix[29,29] = 32000 > > > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > > colorbar() > > show() > > > > However, if the value is really high, the color displayed changes again, > > although still not to the correct color (please try with values 918000, > > 920000, and 999000 to see see it progress): > > > > from pylab import * > > from matplotlib.colors import LogNorm > > > > matrix = ones((30,30)) > > matrix = matrix*440 > > matrix[29,29] = 918000 > > > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > > colorbar() > > show() > > > > And if one specifies no limits to LogNorm, the colorbar displayed is > > incomplete and the colour displayed is wrong in a different way then when > > specifying the limits (try value = 999000 as well). > > > > from pylab import * > > from matplotlib.colors import LogNorm > > > > matrix = ones((30,30)) > > matrix = matrix*440 > > matrix[29,29] = 918000 > > > > matshow(matrix, norm=LogNorm()) > > colorbar() > > show() > > > > > > Either I am completely missing something or there is a major bug. > > > > I am using mpl checked out from svn on 26 March. > > > > Thanks, > > Suresh > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveys-and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
I see where the problem (or at least one problem) is, and I will try to get it fixed by tomorrow. In the meantime, I think you will get the results you want by simply converting your arrays to floating point: matshow(matrix.astype(float), ...) Eric Suresh Pillai wrote: > So I been using the log scale provided by matplotlib.colors.LogNorm, but > have been seing bizarre behaviour. Basically, high values are not > displayed properly. I give simple examples below with just two possible > values in the matrix, but all the same issues arise with more varied > values. > > First notice that the high value (100000) is displayed as being of > value=1: > > from pylab import * > from matplotlib.colors import LogNorm > > matrix = ones((30,30)) > matrix = matrix*440 > matrix[29,29] = 100000 > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > colorbar() > show() > > The cutoff value for incorrect display (for the scale I am using) seems to > be at 32000: > > from pylab import * > from matplotlib.colors import LogNorm > > matrix = ones((30,30)) > matrix = matrix*440 > matrix[29,29] = 32000 > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > colorbar() > show() > > However, if the value is really high, the color displayed changes again, > although still not to the correct color (please try with values 918000, > 920000, and 999000 to see see it progress): > > from pylab import * > from matplotlib.colors import LogNorm > > matrix = ones((30,30)) > matrix = matrix*440 > matrix[29,29] = 918000 > > matshow(matrix, norm=LogNorm(vmin=1, vmax=1000000)) > colorbar() > show() > > And if one specifies no limits to LogNorm, the colorbar displayed is > incomplete and the colour displayed is wrong in a different way then when > specifying the limits (try value = 999000 as well). > > from pylab import * > from matplotlib.colors import LogNorm > > matrix = ones((30,30)) > matrix = matrix*440 > matrix[29,29] = 918000 > > matshow(matrix, norm=LogNorm()) > colorbar() > show() > > > Either I am completely missing something or there is a major bug. > > I am using mpl checked out from svn on 26 March. > > Thanks, > Suresh > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
A really great IDE for windows users is pyScripter ( http://mmm-experts.com/Products.aspx?ProductId=4 ) It's probably the best I could try so far (and it's free). cheers On 3/30/07, Tim Hirzel <hi...@re...> wrote: > As for a good IDE. I really like eclipse with pydev. For easy > student/beginner setup, easyclipse has a nice python eclipse distribution > > http://www.easyeclipse.org/site/distributions/index.html > > I think I've tried near every python IDE setup out there over the last > couple years, and this one wins for me. > > tim > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >