Re: [Matplotlib-users] Drawing shapes outside the plot area
Hello Bryan, On Tuesday 06 May 2008 20:07:58 Bryan Fodness wrote: I would like to be able to draw a triangle on the graph outside the axes and plot area. I have used fill before, but that was in the plot area. Can someone push me in the right direction? Would it be helpful to have a axes instance in the background like: - from pylab import * figure(1) ax1 = axes([0.0, 0.0, 1.0, 1.0], axisbg='0.9') ax2 = axes([0.3, 0.3, .4, .4], axisbg='white') ax1.plot(arange(10), color='b') ax2.plot(linspace(0.0, 1.0, 10.0)**2, color='g') show() --- regards Matthias - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] adding a box (domain) on a basemap map
Hi all sorry for posting this question that might have been answered before, but I'm in the urgent need of finding a way to overlay a rectangular box on a basemap map (cylindrical projection) given the latitudes and longitudes of the domain. This is to delineate on a map the domain over which a index has been computed ... any quick answer welcome thanks -- _/\/¯¯\/\_ 33º49'45.24S 18º28'45.60E Dr. Nicolas Fauchereau post-doctoral fellow Oceanography Dept. University of Cape-Town Private Bag. 7701 Rondebosh Tel: 021 650 53 15 South Africa _/\/¯¯\/\_ 33º49'45.24S 18º28'45.60E - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Canvas coordinates vs. Plot coordinates
Use mpl events -- they work across user interface toolkits and handle stuff like which axes did you click in and what are the data coordinates Excellent, that did the trick. In just 2 minutes. :) Thanks a lot. Could I just chuck in one simple question: you may have noticed I am embedding everything in GTK. After calling gtk.main() is there any way I can modify the displayed window? Or do I have to bin the whole thing and start again? Thanks for your help, Matthew - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] slider_demo.py (online) and radio_buttons.py (svn-examples) broken
Hello list, the nice example of sliders and buttons from the matplotlib screenshots doesn't work anymore (at least) for me under mpl 0.91.2 and latest svn. In http://matplotlib.sourceforge.net/screenshots/slider_demo.py the replacement hovercolor=0.975 - hovercolor=0.975 is needed. The second problem arises only with latest svn. At the end of the mail there's the Traceback, which arises after clicking the radiobutton during running examples/widgets/radio_buttons.py. Any suggestions are welcome. regards Matthias - Traceback (most recent call last): File /media/disk/SOFT//lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py, line 193, in button_press_event FigureCanvasBase.button_press_event(self, x, y, event.button) File /media/disk/SOFT//lib/python2.5/site-packages/matplotlib/backend_bases.py, line 915, in button_press_event self.callbacks.process(s, mouseevent) File /media/disk/SOFT//lib/python2.5/site-packages/matplotlib/cbook.py, line 157, in process func(*args, **kwargs) File /media/disk/SOFT//lib/python2.5/site-packages/matplotlib/widgets.py, line 462, in _clicked xy = self.ax.transAxes.inverse_xy_tup((event.x, event.y)) AttributeError: 'BboxTransformTo' object has no attribute 'inverse_xy_tup' - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bug in qtagg backend when blitting
Great! Cheers, Mike Darren Dale wrote: There it is. Thanks Mike, it looks great on 64-bit Linux! On Tuesday 06 May 2008 03:04:05 pm Michael Droettboom wrote: Thanks. Try again now. Hopefully it's correct this time (your test is a much better unit test than the animation_blit_* examples. Cheers, Mike Darren Dale wrote: I'm testing it out on 64-bit linux with this script: from pylab import * from matplotlib.widgets import Cursor ax=axes() cursor = Cursor(ax, useblit=True) ax.imshow(array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]), cmap=cm.jet, interpolation='nearest') show() When the mouse pointer enters the axes, the cursor is drawn, blitting occurs, along with wierdness. I'm attaching screenshots, one using the new to_string_argb and one using to_string. Darren On Tuesday 06 May 2008 11:43:50 am Michael Droettboom wrote: This is now implemented on the branch and the trunk. Please let me know how it works for you. I'm particularly interested in non-Linux and Big Endian platforms (e.g. PPC) as a sanity check. Cheers, Mike Michael Droettboom wrote: I'll go ahead and fix this. It just fell through the cracks. Mike Darren Dale wrote: On Monday 05 May 2008 09:24:42 pm G Jones wrote: Hello, Attached is a script that when run from ipython --pylab with your backend setup for 'QtAgg' reproduces a bug I am seeing. If you run the plot, you'll see a line plotted in blue as expected. Then when the same figure is updated by blitting, the line turns red. I tried this with green and it stayed green, but yellow went to cyan. It seems that the byteswapping that is necessary for displaying colors correctly in Qt is happening during a normal plot, but not when blitting. I tried going through the code to determine the problem, I can only guess that it lies somewhere in the FigureCanvasQTAgg.paintEvent, since that's where I see to_ARGB etc. Sorry I couldn't locate the bug precisely, I find it very difficult to thread my way through all the backend classes. I did track down the source of the bug a while back: http://sourceforge.net/mailarchive/message.php?msg_id=200803121528.305 65 .darren.dale%40cornell.edu Mike D. suggested that BufferRegion might need a byte-swapped version of to_string(), but unfortunately I am not an experienced c programmer and am short of time to try to work my way through it right now. I added a bug report at SF. Darren -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Possible to optimize canvas update speed?
Hi, I'm plotting lines on top of an image using the plot command, trying to make polygons. I click one point on an image and another point, and a line is drawn between them. I'm also showing a guide line, so that the user can see the line before pressing the mouse button.. All i'm doing is taking the last point that the user clicked on and plot a line between that point and the current point under the mouse cursor. New chosen points are appended to nPolygonPointsX and Y. This works ok, but it's a bit slow. my update connected to the motion_notify_event looks like this: -- def onCursorUpdate(self, event) x, y = event.xdata, event.ydata a = self.fig.gca() if len(self.nPolygonPointsX = 1): guideLineX = [self.nPolygonPointsX[-1], x] guideLineY = [self.nPolygonPointsY[-1], y] # To avoid keeping guide lines when the cursor is moved: if len(a.lines) 1: del(a.lines[-1]) # Plot the guide line and update a.plot(guideLineX, guideLineY) self.canvas.draw() -- Btw i'm running matplotlib with wxpython. So is there a faster way to update this line plot? .. Thanks! Soren - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MPL, py2exe and fonts
Chris Barker wrote: Hi all, I'm successfully getting all the MPL data files into spy2exe with: DATA_FILES = matplotlib.get_py2exe_datafiles() The problem is that that dumps a LOT of stuff, and I don't need most of it. I've already added to my script a few lines that delete the images dir, but I'd like to trim down the fonts to just those I need. I'm using the wxAgg back-end, with all default fonts -- does anyone know which those are? The default text font is Vera.ttf. (If you want to support bold and italic etc, you'll also need VeraBd.tff, VeraBI.ttf and VeraIt.ttf). If you need to support mathtext, the default font is the Computer Modern family, and you'll want all of the cm*.ttf fonts. Alternatively, you can change the default fonts in the matplotlibrc to ones that are included with Windows (e.g. Arial) -- but that won't address the mathtext issue. MPL version: 0.91.2 on Windows (duh!) by the way, is there any way to dump that data into the exe itself, rather than requiring it to be carried alongside? This makes me really appreciate application bundles on the Mac! There are ways, but they're pretty involved -- plus they would require fixing the parts of matplotlib that read in data files: they all implicitly assume that they are real files on a real file system. See: http://www.py2exe.org/index.cgi/SingleFileExecutable I once worked on a commercial project that had a fairly complex network installer written in Python and distributed in a similar way. Not for the faint of heart. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Canvas coordinates vs. Plot coordinates
On Wed, May 7, 2008 at 7:41 AM, Matthew Czesarski [EMAIL PROTECTED] wrote: Could I just chuck in one simple question: you may have noticed I am embedding everything in GTK. After calling gtk.main() is there any way I can modify the displayed window? Or do I have to bin the whole thing and start again? Sorry, I don't really understand the question, but you can certainly modify the gtk application, you will just need to do it in the gtk loop, eg in an idle or timeout handler, or in a callback. JDH - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Possible to optimize canvas update speed?
On Wed, May 7, 2008 at 9:17 AM, Søren Nielsen [EMAIL PROTECTED] wrote: Hi, I'm plotting lines on top of an image using the plot command, trying to make polygons. I click one point on an image and another point, and a line is drawn between them. I'm also showing a guide line, so that the user can see the line before pressing the mouse button.. All i'm doing is taking the last point that the user clicked on and plot a line between that point and the current point under the mouse cursor. New chosen points are appended to nPolygonPointsX and Y. This works ok, but it's a bit slow. Take a look at the animation tutorial: http://www.scipy.org/Cookbook/Matplotlib/Animations - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] slider_demo.py (online) and radio_buttons.py (svn-examples) broken
Matthias Michler wrote: The second problem arises only with latest svn. At the end of the mail there's the Traceback, which arises after clicking the radiobutton during running examples/widgets/radio_buttons.py. This is now fixed in SVN. It hadn't been updated to use the new transforms framework. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] specifying colors in 'extend' option of contourf
I cannot get the contourf extended color map ranges to show up in the plot. the extend option of contourf states: extend = 'neither', 'both', 'min', 'max' Unless this is 'neither' (default), contour levels are automatically added to one or both ends of the range so that all data are included. These added ranges are then mapped to the special colormap values which default to the ends of the colormap range, but can be set via Colormap.set_under() and Colormap.set_over() methods The code at the of this message produces a plot with color bar extensions that are the end colors of the bone colormap and not red and green. The colorMap._rgba_over value is red and the colorMap._rgba_under value is green, but this is not reflected in the plot. Any idea what I am doing wrong? I am using matplotlib 0.91.1 --Jim figure() colorMap = cm.bone colorMap.set_over('r') colorMap.set_under('g') CS = contourf(X, Y, Z, 10,cmap=colorMap,origin=origin, extend = 'both') cbar = colorbar(CS) savefig('contourf_demo1') - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Square brackets in mathtext (version 0.91.2)
Dear all, The following TeX expression did not produce any error message with matplotlib versions 0.87.3 - 0.90.2 : r'$Wavenumber,\ [\ cm^{-1}\ ]$' The following error is produced with version 0.91.2 : class 'matplotlib.pyparsing.ParseFatalException': Expected end of math '$' $Wavenumber,\ [\ cm^{-1}\ ]$ (at char 0), (line:1, col:1) The problem comes about because of the square brackets. Could everyone please explain me how to handle this situation (without placing the brackets outside of '$$') ? Thanks in advance, Dr. Maxim Fedorovsky. - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] from pylab import nx?
Hi All, I have the same issue, is there a fix to this Michael Droettboom-3 wrote: Eric Firing wrote: Chris Withers wrote: Hi All, A few of the units demos include the lines: from pylab import nx ...but this import errors for me. Why is that? If you are referring to scripts in the matplotlib/examples/ subdirectory then you must have a version in which some of those scripts had not been brought up to date with the rest of matplotlib. (Historically, this has often been the case--only a subset of the examples are maintained. Right now, for example, simple3d.py is broken. 3D plotting is itself unmaintained, so there is little incentive to do anything about the example.) In the svn version there are no lines importing nx. This was an abbreviation for the numerix module, which was a compatibility wrapper for the three different numeric packages (Numeric, numarray, and numpy) until numpy was fully developed, rendering Numeric and numarray obsolete. Slightly OT, but if matplotlib is participating in any sort of internship projects (Google Summer of Code etc.) that would be a great student project -- to clean up all the examples, removing dead ones, editing for consistency etc. Cheers, Mike - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://www.nabble.com/from-pylab-import-nx--tp16118581p17105429.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] segmentation fault with pylab
Hello, I am experiencing a problem recently on my Mac OsX. When I try to import mathplotlib.mathtext or pylab I received a segmentation fault error. It wasn't like that before, and I recently update my matplotlib and scipy via fink. It worked fine few weeks ago. I hope someone can help me. Thanks, Nino - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib and cron
Hi I am attempting to generate graphs using matplotlib/pyplot via a cron process. These scripts work perfectly fine when I am logged in and run the scripts on the command line, however they fail to run when they are set up as a cronjob. Even a simplified plotting routine does not work: from matplotlib.pylab import plot from matplotlib.pylab import savefig plot([1,2,3,4]) savefig('test.png') my crontab is configured like this: SHELL= /bin/tcsh 45 8 * * * cd [path to script]; python graphtest.py Thanks in advance, -- Andre Wong Gemini North Data Analyst [EMAIL PROTECTED] (808) 974 2626 - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Polar charts question
Is it possible to make a chart like this: http://www.advsofteng.com/images/multiradar_g.png with matplotlib? Where can I find some examples? Thanks a lot. - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MPL, py2exe and fonts
Michael Droettboom wrote: Chris Barker wrote: I'm successfully getting all the MPL data files into spy2exe with: DATA_FILES = matplotlib.get_py2exe_datafiles() The problem is that that dumps a LOT of stuff, and I don't need most of it. The default text font is Vera.ttf. (If you want to support bold and italic etc, you'll also need VeraBd.tff, VeraBI.ttf and VeraIt.ttf). I removed all other fonts, and it works fine, thanks! Alternatively, you can change the default fonts in the matplotlibrc to ones that are included with Windows (e.g. Arial) -- I took a look in matplotlibrc, and saw what looks like a html-ish cascade of fonts to look for, and Arial was in there. So I tried removing all the fonts, and behold, the system fonts were used. So now all I have in the mpl-data dir is matplotlibrc. Then I thought, I haven't changed any defaults in matplotlibrc, either, so I pulled that out. Now it runs fine, but when I close, I get an error box: see the logfile: and indeed there is a pH.exe.log file, and in there is: C:\Documents and Settings\chris.barker\My Documents\HAZMAT\SmallTools\phCalculator\trunk\dist\pH.exe\matplotlib\__init__.py:520: UserWarning: Could not find matplotlibrc; using defaults C:\Documents and Settings\chris.barker\My Documents\HAZMAT\SmallTools\phCalculator\trunk\dist\pH.exe\matplotlib\__init__.py:566: UserWarning: could not find rc file; returning defaults Is there a way to supress those warnings and not write the logfile? I've never really liked matplotlibrc -- it's kind of nice not to have it at all, and it doesn't seem to be required. Maybe this is a wx issue -- how to bury that warning. So then I tried removing mpl-data, but the app wouldn't run, I got an error, and the logfile says: Traceback (most recent call last): File pH.py, line 8, in module File zipextimporter.pyo, line 82, in load_module File Lib\Gui.pyo, line 15, in module File wxaddons\__init__.pyo, line 180, in import_hook File zipextimporter.pyo, line 82, in load_module File matplotlib\__init__.pyo, line 639, in module File matplotlib\__init__.pyo, line 562, in rc_params File matplotlib\__init__.pyo, line 517, in matplotlib_fname File matplotlib\__init__.pyo, line 207, in wrapper File matplotlib\__init__.pyo, line 447, in _get_data_path_cached File matplotlib\__init__.pyo, line 443, in _get_data_path RuntimeError: Could not find the matplotlib data files since I'm not, in fact needing any of the files in mpl-data, it might be nice if this error could be moved to when it's actually needed. I do notice that there is already a if getattr(sys,'frozen',None) stanza, so maybe we could tweak something there. This may all be a pain, and I suppose this approach would only work with the simplest of MPL apps (like mine), but it would be nice to clean up MPL so that it plays better with py2exe and the like. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] - This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users