Re: [Matplotlib-users] os x backends
On 31.05.2007, at 20:34, Jeff Whitaker wrote: The fink matplotlib package uses GTKAgg as the default backend, and works fine over an ssh tunnel. The admin will have to: 0) make sure X11.app (and the X11 SDK) is installed. 1) install fink 2) run 'fink selfupdate' 3) run 'fink install matplotlib-py25' (and wait a few hours for everything to compile). Same holds for MacPorts -- it has matplotlib in variants tk, gtk2, and wxPython. I guess in your case you would need to convince yur Admin to install MacPorts, or install as a normal user, which might work -- that would then include gtk2 or wxWidgets as necessary. Greetings, Jochen -- Einigkeit und Recht und Freiheithttp://www.Jochen- Kuepper.de Liberté, Égalité, FraternitéGnuPG key: CC1B0B4D Sex, drugs and rock-n-roll PGP.sig Description: This is a digitally signed message part - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Basemap reuse
Hi matplotlib users, I have a small web application for calculating tsunami travel times (http://ocean.dmi.dk/apps/tsunami). The application uses matplotlib/basemap for producing contour maps of the tsunami travel times. To speed up the response time of the application I made a version in which the calculations are performed for every second integer longitude and latitude for calculation windows of 60x60 degrees lon x lat, 90x90, 180x180 and global. This is a lot of plots for which I am making a new Basemap instances for each plot since: llcrnrlon llcrnrlat urcrnrlon urcrnrlat differs for each plot. The initialization of the Basemap instances are responsible for the vast majority of the CPU usage in the application. In converting the application to numpy (from numarray) I was wondering whether I could reduce the plotting time as well. Is it possible to reuse a Basemap instance somehow in my case or is that out of the question? Regards, Jesper - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap reuse
Jesper Larsen wrote: Hi matplotlib users, I have a small web application for calculating tsunami travel times (http://ocean.dmi.dk/apps/tsunami). The application uses matplotlib/basemap for producing contour maps of the tsunami travel times. To speed up the response time of the application I made a version in which the calculations are performed for every second integer longitude and latitude for calculation windows of 60x60 degrees lon x lat, 90x90, 180x180 and global. This is a lot of plots for which I am making a new Basemap instances for each plot since: llcrnrlon llcrnrlat urcrnrlon urcrnrlat differs for each plot. The initialization of the Basemap instances are responsible for the vast majority of the CPU usage in the application. In converting the application to numpy (from numarray) I was wondering whether I could reduce the plotting time as well. Is it possible to reuse a Basemap instance somehow in my case or is that out of the question? Regards, Jesper Jesper: As long as you are using the cylindrical equidistant projection, something like this might work: from matplotlib.toolkits.basemap import Basemap import pylab as p map = Basemap() map.fillcontinents(color='coral') map.drawparallels(p.arange(-90,91,30)) map.drawmeridians(p.arange(-180,181,30)) p.savefig('fig1.png') ax = p.gca() llcrnrlat = 20 llcrnrlon = -140 urcrnrlat = 55 urcrnrlon = -65 corners = ((llcrnrlon,llcrnrlat), (urcrnrlon,urcrnrlat)) ax.update_datalim( corners ) ax.set_xlim((llcrnrlon, urcrnrlon)) ax.set_ylim((llcrnrlat, urcrnrlat)) p.savefig('fig2.png') llcrnrlat = 30 llcrnrlon = -20 urcrnrlat = 80 urcrnrlon = 50 corners = ((llcrnrlon,llcrnrlat), (urcrnrlon,urcrnrlat)) ax.update_datalim( corners ) ax.set_xlim((llcrnrlon, urcrnrlon)) ax.set_ylim((llcrnrlat, urcrnrlat)) p.savefig('fig3.png') You might not be able to get labels on the meridians and parallels with this approach though. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1FAX : (303)497-6449 325 BroadwayBoulder, CO, USA 80305-3328 - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap reuse
Jesper Larsen wrote: Hi matplotlib users, I have a small web application for calculating tsunami travel times (http://ocean.dmi.dk/apps/tsunami). The application uses matplotlib/basemap for producing contour maps of the tsunami travel times. To speed up the response time of the application I made a version in which the calculations are performed for every second integer longitude and latitude for calculation windows of 60x60 degrees lon x lat, 90x90, 180x180 and global. This is a lot of plots for which I am making a new Basemap instances for each plot since: llcrnrlon llcrnrlat urcrnrlon urcrnrlat differs for each plot. The initialization of the Basemap instances are responsible for the vast majority of the CPU usage in the application. In converting the application to numpy (from numarray) I was wondering whether I could reduce the plotting time as well. Is it possible to reuse a Basemap instance somehow in my case or is that out of the question? Regards, Jesper Jesper: Here's a better way, that allows you to label the meridians and parallels. It will only work for projection='cyl', although a similar solution could be worked up for 'merc' and 'mill'. from matplotlib.toolkits.basemap import Basemap import pylab as p def resetmapbounds(map,llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat): map.llcrnrlat = llcrnrlat; map.llcrnrlon = llcrnrlon map.urcrnrlat = urcrnrlat; map.urcrnrlon = urcrnrlon map.llcrnry = map.llcrnrlat; map.llcrnrx=map.llcrnrlon map.urcrnry = map.urcrnrlat; map.urcrnrx=map.urcrnrlon return map fig = p.figure() # create the Basemap instance map = Basemap() map.fillcontinents(color='coral') map.drawparallels(p.arange(-90,91,30),labels=[1,1,1,1]) map.drawmeridians(p.arange(-180,181,30),labels=[1,1,1,1]) #p.savefig('fig1.png') # resuse the Basemap instance, resetting the lat/lon domain. # US Domain. fig = p.figure() map = resetmapbounds(map,-140,20,-65,55) map.fillcontinents(color='coral') map.drawparallels(p.arange(-90,91,10),labels=[1,1,1,1]) map.drawmeridians(p.arange(-180,181,10),labels=[1,1,1,1]) #p.savefig('fig2.png') # Europe Domain. fig = p.figure() map = resetmapbounds(map,-20,30,40,80) map.fillcontinents(color='coral') map.drawparallels(p.arange(-90,91,10),labels=[1,1,1,1]) map.drawmeridians(p.arange(-180,181,10),labels=[1,1,1,1]) #p.savefig('fig3.png') p.show() HTH, -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-6449 NOAA/OAR/PSD R/PSD1Email : [EMAIL PROTECTED] 325 BroadwayOffice : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web: http://tinyurl.com/5telg - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] os x backends
I think we want to keep matplotlib associated with the OS X Framework install of python; if we installed the macports version, am I correct in assuming that we could just dump the resulting python modules (eg. gtk, tkinter, and matplotlib) into the Framework install's site-packages dir (or more likely my own PYTHONPATH dir) and disregard the macports distro of python? On Fri, 1 Jun 2007, Jochen Küpper wrote: On 31.05.2007, at 20:34, Jeff Whitaker wrote: The fink matplotlib package uses GTKAgg as the default backend, and works fine over an ssh tunnel. The admin will have to: 0) make sure X11.app (and the X11 SDK) is installed. 1) install fink 2) run 'fink selfupdate' 3) run 'fink install matplotlib-py25' (and wait a few hours for everything to compile). Same holds for MacPorts -- it has matplotlib in variants tk, gtk2, and wxPython. I guess in your case you would need to convince yur Admin to install MacPorts, or install as a normal user, which might work -- that would then include gtk2 or wxWidgets as necessary. Greetings, Jochen - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] question on annotating subplot / size of markers
Hello, I was wondering if it would be possible to draw a vertical line in a subplot, in such a way that the line exactly covers top to bottom of the subplot, say - if the subplot has a height of 80 points, the vertical line's length will be 80 points. Also, this vertical line may have an horizontal line that starts from it for a given length. like this |-; | being the vertical line and being the horizontal line. Is there any way to implement this in Matplotlib. It'd also be nice to have a text annotating the horizontal and vertical line, something like this: --- | | | |annotation1 | | subplot | | | | | | | | | --- There likely will be 3-4 subplots like the above in a figure. The 3-4 subplots contain a plot of some data. In effect, it is like placing an annotation on the subplot data with a marker that illustrates the data position where the annotation is, and the length of the marker that specifies how long the portion of data on the plot the annotation runs. Here's a snippet I wrote, but it doesn't cover the height of the subplot fully, it takes xycoords as 'data'. self.axes.annotate(annotation1, xy=(locn,ytextlocn), xycoords='data', color='brown', markerprops=dict(marker='|', markerfacecolor='black', markersize=94, markeredgecolor='black', markeredgewidth = 2), ) self.axes.annotate(annotation1, xy=(locn, ytextlocn), xycoords='data', color='brown', markerprops=dict(marker=TICKRIGHT, markerfacecolor='black', markersize=(length_of_annotation1), markeredgecolor='black', markeredgewidth = 2), horizontalalignment='right', verticalalignment='top', ) What could be the best way to avoid annotations from overlapping in the plot? I guess this is kind of a complicated question. Please let me know if I wasn't sufficiently clear. I'm new to Mpl, and I may have overlooked something, or I may be doing something wrong. Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib RPM on SUSE 10.2?
John Pye schrieb: Hi all Can anyone tell me whether or not it is straightforward to run matplotlib on OpenSUSE 10.2? My project has a dependency on matplotlib and I have a user on that platform who tells me that it's not available as an RPM in the SUSE repository. Can that really be true? On http://software.opensuse.org/download/science/openSUSE_10.2/ there is a quite recent RPM (and also of numpy, scipy, etc) Gregor - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Handling LARGE data sets
[EMAIL PROTECTED] wrote: Hi Alan, I'm not speaking for anyone else, but as far as I'm concerned that code is public domain. OK, well, who wrote the code and who holds the copyright? In other words, your concerns about the code being in the public domain may or may not be relevant, depending on where the code came from and whether you have any legal authority to distribute the code and under what conditions. It would be nice to include an SG filter in scipy, for example, but that would only be possible if it were released under a BSD-like license. -Andrew - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plot vs Line Collections
Hi John, On 5/31/07, John Hunter wrote: On 5/31/07, Andrea Gavana [EMAIL PROTECTED] wrote: Hi All, I am writing an application (wxPython based) which embeds a big matplotlib figure as a main panel. Basically, this app shows oil well producers and gas injectors on a 2D map as dots (every dot represents its surface location), and a bunch of streamlines (i.e., straight lines or simple curves) which connect injectors and producers. As the numerical simulation continues, more and more streamlines are added to the plot (because of new wells or because interference between wells), and actually I end up having 200 dots plus 800-1200 lines. As the simulation progresses, the plots become slower and slower... As the lines are usually 2-points straight lines, I was thinking about using Line Collections; however, every matplotlib line has a linewidth value that is dependent on the calculated interference effect between wells, which means I have to build a matplotlib line for every line connecting an injector with a producer. Moreover, every injector well has its own colour for the streamlines (there are 33 injector wells). Will Line Collections save some time in this case? If not, does anyone have a suggestion on how I could try to speed-up the plotting? I am not really familiar with some obscure line/axes properties, so I may have overlooked something. Yes, a line collection will save you a lot of time with upwards of 1000 line segments. This is the use case they were designed to solve: a bunch of segments of differing widths and colors. One could optimize it for the special case of simple line segments, ie [(x1,y1), (x2, y2)] in which case we could use numpy arrays, but currently we have only the general case of a collection of arbitrary length segments, and since they are not necessarily the same length, we use a sequence of segments rather than an array, and this is slower than it could be. I managed to get things twice faster than before using Line Collections (even though some more optimization can be done). However, I am facing a problem with the legend: as I put all the lines in a single collection, and I don't want all the lines to be marked in the legend but only the ones with biggest linewidth for every injector well, how do I get a particular line of the collection in order to legend() that line only? I didn't find any method or attribute about that. Maybe it is just plain impossible. Thank you for every hint. Andrea. Imagination Is The Only Weapon In The War Against Reality. http://xoomer.virgilio.it/infinity77/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users