Re: [Matplotlib-users] Plot aliasing
On Sat, Dec 27, 2008 at 10:29 AM, Kaushik Ghose kaushik_gh...@hms.harvard.edu wrote: Hi Gang, I was plotting some data collected from an ADC and noticed an odd aliasing issue. Please see the images on the following site. http://assorted-experience.blogspot.com/2008/12/odd-aliasing-issue-with-matplotlib.html I wonder if there is any way to avoid this kind of aliasing. I vaguely remember our old arch-foe (MATLAB) handles this gracefully. I have found matplotlib's plotting to be superior to MATLAB's in every way (except for 3D) and it would be nice if aliasing could be handled gracefully. I'm almost certain this is a result of the path simplification logic. Could you upload some sample data and a self contained script so we can test? You can test this by editing site-packages/path.py and replacing:: self.should_simplify = (len(vertices) = 128 and (codes is None or np.all(codes = Path.LINETO))) with:: self.should_simplify = False Michael, perhaps we could override path.should_simplify with an rc or line property? Also, thanks for the excellent binary packages for Mac! Thanks for testing them! -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Backtrace when including a legend with 0.98.5.1
On Fri, Dec 26, 2008 at 4:14 AM, Adam Mercer ramer...@gmail.com wrote: Hi I've noticed that one of my codes is failing with the following backtrace since updating to 0.98.5.1: Could you please post a complete, free-standing example? Also, you might want to test against 98.5.2 which has been released with some legend fixes. JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bugfix for: ImportError: No module named _backend_gdk
On Tue, Dec 23, 2008 at 11:48 PM, Balaji S. Srinivasan bala...@stanford.edu wrote: I figured out that this was due to an extra comma in setupext.py. Edit line 1347 to remove the extra comma, changing this: module = Extension( 'matplotlib.backends._backend_gdk', ['src/backend_gdk.c', ], # HERE IS THE BAD EXTRA COMMA libraries = [], include_dirs=numpy_inc_dirs, ) to this: module = Extension( 'matplotlib.backends._backend_gdk', ['src/backend_gdk.c' ], libraries = [], include_dirs=numpy_inc_dirs, ) Then This doesn't make any sense, because the two lists are identical:: In [127]: x = ['src/backend_gdk.c', ] In [128]: len(x) Out[128]: 1 In [129]: x Out[129]: ['src/backend_gdk.c'] In [130]: y = ['src/backend_gdk.c'] In [131]: len(y) Out[131]: 1 In [132]: y Out[132]: ['src/backend_gdk.c'] In [133]: x==y Out[133]: True -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can't build on Ubuntu Intrepid
On Sat, Dec 20, 2008 at 12:19 AM, Ryan Wagner rwag...@vni.com wrote: Hi guys, I've been trying to build the newest version of MPL on Ubuntu Intrepid for a few days now. I'm not getting anywhere. I believe I have all the correct dev packages installed. I had tried to build 0.98.3 but it came out via apt-get. Can anyone take a look at my install output (attached) and give me an idea of what I may be doing wrong? TIA Is it possible you are not using g++ here ? The compile line that is failing is cc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -ansi -m64 -w -DCOMPUTER_LOPT64 -DANSI -I/usr/local/VNI/imsl/cnl600/linux64/include -fPIC -I/usr/lib/python2.5/site-packages/numpy/core/include -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/include/python2.5 -c CXX/cxxextensions.c -o build/temp.linux-x86_64-2.5/CXX/cxxextensions.o In file included from CXX/cxxextensions.c:38: ./CXX/WrapPython.h:1: error: expected identifier or '(' before '/' token The line in question, line 1 of WrapPython.h, is simply a comment. Flags like -DANSI -I/usr/local/VNI/imsl/cnl600/linux64/include indicate to me you have some non-standard stuff in your build environment, and perhaps you are picking up a different compiler or library, perhaps the intel compiler? If you are trying to compile with the intel compiler, you may need to set the CC and CXX environment variables to make sure you are using the c++ compiler. If you can use g++, you are more likely to have success. Before building, I suggest export CC=gcc export CXX=g++ You might also try and remove the CFLAGS that are causing the visual numerics include flags to set. JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] legend: axespad, pad, handlelen, labelsep - without effect
On Fri, Dec 19, 2008 at 8:36 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: The legend class has been reimplemented recently and the name of some keyword arguments (and their meaning) has been changed. Those parameters you're using are deprecated ones. It is supposed to show you some warnings if deprecated parameters are used, so what you see is a bug. I'll take a look. I also noticed that the documentaion of the pylab.legend is outdated. Take a look at Jae-Joon, I don't think these changes ever made it into doc/api/api_changes.rst. Could you update that file in the branch, and I'll push it out the web site. Thanks, JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] figimage and image magnification (was: imshow with pdf)
On Mon, Dec 15, 2008 at 2:44 PM, John Hunter jdh2...@gmail.com wrote: I am not sure what figimage should mean for a vector backend so I want to hear from Perry who motivated the function. When I implemented it on his original request, I understood it to be a raw pixel dump to the canvas with no scaling, no interpolation, etc What does a pixel dump to a canvas mean for a vector backend? I think we could define something that was at least consistent, but we should probably hear from Perry et al who are presumably using the function. After sleeping on this overnight, I think the answer here is clear. figimage is meant to be a pixel dump, so we should just treat a pixel as a dot. When dpi is increased, the number of dots on the canvas increases so the figimage should look smaller. I added your patch and support for magnification to figimage -- the output looks right for PNG, PDF and EPS -- svg still not. I haven't had a chance to look but perhaps SVG does not utilize the magnification param. I'll check into this later. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bad keys in event.key
On Wed, Dec 17, 2008 at 1:24 PM, James Schombert jscho...@uoregon.edu wrote: Using matplotlib 0.98.5 on OSX 10.5, the following error occurs for many key_press events using the standard connect class - letter such as c,v,s etc (and most important, backspace) Exception in Tkinter callback Traceback (most recent call last): File /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk/Tkinter.py, line 1403, in __call__ return self.func(*args) File /Library/Python/2.5/site-packages/matplotlib/backends/backend_tkagg.py,line 312, in key_press FigureCanvasBase.key_press_event(self, key, guiEvent=event) File /Library/Python/2.5/site-packages/matplotlib/backend_bases.py, line 1122, in key_press_event self.callbacks.process(s, event) File /Library/Python/2.5/site-packages/matplotlib/cbook.py, line 155, in process func(*args, **kwargs) File /Library/Python/2.5/site-packages/matplotlib/backend_bases.py, line 1626, in key_press self.canvas.toolbar.back() AttributeError: FigureCanvasTkAgg instance has no attribute 'toolbar' would a full list of the bad keys help I am not seeing this on the 0.98.5 release candidate. I fire up python simple_plot.py -dTkAgg and click 'c' somewhere on the figure/axes, or 'delete' and I am not getting the traceback. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] OSX 10.5 event.key bug
On Wed, Dec 17, 2008 at 12:22 PM, Matthias Michler matthiasmich...@gmx.net wrote: Hello John and others, my favorite solution is: * axes param: specific for a given axes in figure; interface would be something like ax.auto_toolbar_keys(False) This is on my list of things to do JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [Fwd: Matplotlib 0.98.5 egg on Mac OS X : Install Problem]
On Wed, Dec 17, 2008 at 2:29 PM, Kaushik Ghose kaushik_gh...@hms.harvard.edu wrote: Hi Everyone, I am running into a problem when trying to install 0.98.5 egg on a Mac OS X machine. Any help much appreciated. Relevant error messages follow: I posted binaries to fix this problem and have requested testers, so please try the binaries at https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194release_id=646644 You might want to be sure to delete the old dir to get a clean install sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib* before installing the new. Let me know how it goes. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib 0.98.5 egg on Mac OS X : Install Problem
On Wed, Dec 17, 2008 at 2:32 PM, Kaushik Ghose kaushik_gh...@hms.harvard.edu wrote: Hi Everyone, I am running into a problem when trying to install 0.98.5 egg on a Mac OS X machine. Any help much appreciated. Relevant error messages follow: Did you miss my repeated posts on this subject, asking for people to test the new binaries that (hopefully) have fixed this problem? https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194release_id=646644 -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error with matplotlib-0.98.5.1-py2.5-macosx10.5.mpkg
On Wed, Dec 17, 2008 at 4:43 PM, Kaushik Ghose kaushik_gh...@hms.harvard.edu wrote: Hi John, The install goes fine, but I come up blank on the import. Thanks -Kaushik sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib* ++ sudo installer -pkg matplotlib-0.98.5.1-py2.5-macosx10.5.mpkg -target / installer: Package name is matplotlib 0.98.5.1-r0 installer: Installing at base path / installer: The install was successful. +++ In [1]: import pylab Please run the following commands after cleaning the previous installs and reinstalling the mpkg file:: ls python -c 'import matplotlib; print matplotlib.__file__' python -c 'import matplotlib; print matplotlib.__version__' python -c 'import pylab' The ls is important because sometimes a person has a directory named 'matplotlib' in their local path, and this is getting picked rather than the installed matplotlib which contains the pylab module. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error with matplotlib-0.98.5.1_r0-py2.5-macosx-10.3-fat.egg
On Wed, Dec 17, 2008 at 4:50 PM, Kaushik Ghose kaushik_gh...@hms.harvard.edu wrote: Hi John, I tried the .egg package but no joy. Thanks -Kaushik sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib* sudo easy_install matplotlib-0.98.5.1_r0-py2.5-macosx-10.3-fat.egg Processing matplotlib-0.98.5.1_r0-py2.5-macosx-10.3-fat.egg creating /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.5.1_r0-py2.5-macosx-10.3-fat.egg Extracting matplotlib-0.98.5.1_r0-py2.5-macosx-10.3-fat.egg to /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages Adding matplotlib 0.98.5.1-r0 to easy-install.pth file Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.5.1_r0-py2.5-macosx-10.3-fat.egg Processing dependencies for matplotlib==0.98.5.1-r0 Searching for matplotlib==0.98.5.1-r0 Reading http://pypi.python.org/simple/matplotlib/ Reading http://matplotlib.sourceforge.net Reading http://sourceforge.net/project/showfiles.php?group_id=80706 Reading https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194 Reading https://sourceforge.net/project/showfiles.php?group_id=80706package_id=82474 No local packages or download links found for matplotlib==0.98.5.1-r0 error: Could not find suitable distribution for Requirement.parse('matplotlib==0.98.5.1-r0') Eggs are an abomination -- the person who named the installer easy_install should have their license revoked. I think we may distributing them because they are simply broken in too many ways. This recurring problem -- where the easy_install goes looking on pypi for an egg even though you are pointing at one locally on the file system, is simply ridiculous. Chris Barker suggests renaming the egg to matplotlib-0.98.5-py2.5.egg. Try that, and please let me know. Thanks for the testing. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] symbol skip in plot command
On Tue, Dec 16, 2008 at 10:30 AM, John Hunter jdh2...@gmail.com wrote: using in favour of matplotlib). Plotting the data twice- the first time without symbol showing every data point and the second time onlywith the symbol and some skip in the data - doesn't help as I now get two entities in the legend. There is a way to do this, but it is not terribly elegant. The tricky part is to get the legend right:: I just added a new line property called markevery to support subsampling markers. Included below is the docstring and nosetest which should clearly indicate usage: def set_markevery(self, every): Set the markevery property to subsample the plot when using markers. Eg if ``markevery=5``, every 5-th marker will be plotted. *every* can be None Every point will be plotted an integer N Every N-th marker will be plotted starting with marker 0 A length-2 tuple of integers every=(start, N) will start at point start and plot every N-th marker ACCEPTS: None | integer | (startind, stride) def test_markevery(): x, y = np.random.rand(2, 100) # check marker only plot fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y, 'o') ax.plot(x, y, 'd', markevery=None) ax.plot(x, y, 's', markevery=10) ax.plot(x, y, '+', markevery=(5, 20)) fig.canvas.draw() plt.close(fig) # check line/marker combos fig = plt.figure() ax = fig.add_subplot(111) ax.plot(x, y, '-o') ax.plot(x, y, '-d', markevery=None) ax.plot(x, y, '-s', markevery=10) ax.plot(x, y, '-+', markevery=(5, 20)) fig.canvas.draw() plt.close(fig) -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] symbol skip in plot command
On Tue, Dec 16, 2008 at 10:09 AM, Michael Oevermann michael.oeverm...@tu-berlin.de wrote: Hi all, I am trying to find a solution to the following problem (without success so far): I have some high frequency data which I want to plot with a simple plot command using a solid line and a symbol. However, since I have many many data points I want to plot the symbol only every N'th data point. Is there a skip parameter or any other way to tell matplotlib to actually plot the symbol only at every N'th data point (I know it is possible in grace which I have stopped using in favour of matplotlib). Plotting the data twice- the first time without symbol showing every data point and the second time onlywith the symbol and some skip in the data - doesn't help as I now get two entities in the legend. There is a way to do this, but it is not terribly elegant. The tricky part is to get the legend right:: import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) N = 10 x = np.arange(100.) y = x**2 # the solid line, suppress auto legend line1, = ax.plot(x, y, linestyle='-', color='black', label='_nolegend_') # every N-th marker, suppress auto legend line2, = ax.plot(x[::N], y[::N], linestyle='', marker='o', markerfacecolor='blue', label='_nolegend_') # the proxy line, both solid and markers. Don't add it to plot, just # use it in legend import matplotlib.lines as lines proxyline = lines.Line2D([0,1], [0,1], linestyle='-', color='black', marker='o', markerfacecolor='blue') leg = ax.legend([proxyline], ['my label']) plt.show() JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can not build trunk on windows
On Tue, Dec 16, 2008 at 12:38 PM, Jörgen Stenarson jorgen.stenar...@bostream.nu wrote: Hi I get the following error when I try to build matplotlib on a windows machine. It builds fine if I comment out the offending line in setup.py. C:\python\external\matplotlib-trunkpython setup.py config --compiler=mingw32 build --compiler=mingw32 bdist Traceback (most recent call last): File setup.py, line 13, in module del os.link AttributeError: link Thanks -- I'll fix it. This is a hack to prevent distutils from copying our symlinks, which is breaking easy_install. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] error installing matplotlib from egg
On Mon, Dec 15, 2008 at 7:08 PM, Michael Hearne mhea...@usgs.gov wrote: I get the following output when trying to install the latest version of matplotlib from an egg. I'm running Mac OS X 10.5.5. We've had a lot of trouble with our eggs. I am not sure this is all our fault, because it looks like some combination of distutils and setuptools is breaking in the presence of symlinks, which we use. I'm modified our installs to work around this problem, and have posted new eggs at https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194release_id=646644 You have two choices for OS X : * matplotlib-0.98.5.1-py2.5-macosx10.5.zip - a binary mpkg installer * matplotlib-0.98.5.1-py2.5-macosx.egg - an egg with the known problems fixed. Please give it another whirl and let me know. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] error installing matplotlib from egg
On Tue, Dec 16, 2008 at 2:13 PM, Michael Hearne mhea...@usgs.gov wrote: John - I get the same error at the end. I've been able to build the package from the tarball successfully. Output follows: No, this is not the same. In the original post you had error: lib/matplotlib/mpl-data/matplotlib.conf.template which was breaking the install (I think). This is the bug I fixed. The CleanUpFile exceptions are annoying but mostly harmless, and I have a post to distutils.sig about them. Let me know if you have information otherwise. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] symbol skip in plot command
On Tue, Dec 16, 2008 at 2:20 PM, Michael Oevermann michael.oeverm...@tu-berlin.de wrote: That's exactly what I was looking for! But how do I get the new feature into my matplotlib version? Either wait for the next release and use the workaround for now, or install from svn. See http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn Nightly builds are on the list of things to do, but we have bigger fish to fry at the moment. What platform are you on? -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] os x egg fubar?
On Tue, Dec 16, 2008 at 2:17 PM, Christopher Barker chris.bar...@noaa.gov wrote: However, once installed, I tried to run it, and got libpng issues -- aaarrgg!: Could you also test the mpkg zip file -- I am curious if that shows the same png problems for you. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] os x egg fubar?
On Tue, Dec 16, 2008 at 2:25 PM, John Hunter jdh2...@gmail.com wrote: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5.egg/matplotlib/_png.so, 2): Symbol not found: _png_destroy_read_struct Referenced from: Well, at least we have a *different* bug to focus on. I'll try and reproduce this somewhere I wonder if this is backend dependent (eg you are using a backend that also links png and something is getting confused). Could you try running :: Just a quick comment -- the symbol _png_destroy_read_struct is not defined in the png sources I am using (png_destroy_read_struct is). Thus it looks like a C++ name mangling issue, probably introduced when the mpl c++ includes and links against the code. Just throwing this out there in case anyone has advice on special flags to use when building universal binaries to prevent name mangling issues. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] os x egg fubar?
On Tue, Dec 16, 2008 at 3:59 PM, John Hunter jdh2...@gmail.com wrote: Just a quick comment -- the symbol _png_destroy_read_struct is not defined in the png sources I am using (png_destroy_read_struct is). Thus it looks like a C++ name mangling issue, probably introduced when the mpl c++ includes and links against the code. Just throwing this out there in case anyone has advice on special flags to use when building universal binaries to prevent name mangling issues. I *may*, repeat *may*, have had a breakthrough here. It appears that setting the universal flags on the make line is not enough -- they must actually be exported (as Charlie's original notes indicate). Please try again with the new OS X binaries at https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194release_id=646644 I didn't do any clever renaming of the egg this time -- just focusing on the png name manging error. Fingers crossed, JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] os x egg fubar?
On Tue, Dec 16, 2008 at 3:17 PM, Christopher Barker chris.bar...@noaa.gov wrote: python myfile.py -dPS same error -- why does it need to use png at all with PS? Chris, Thanks for all the tests. The image module uses _png. Even the vector backends need raster images. We could move the import into the method when it is actually called, since we actually embed the images directly into the ps and do not go via png. Could you also test the mpkg zip file -- I am curious if that shows the same png problems for you. same errors as the egg. Can you test on PPC? I do have an old, clunky OSX 10.3 machine at home. A little afraid to go there :-( I recently had a problem with a wxPython extension -- it build Universal, but only worked on Intel. It turns out that the wxPython binaries were compiled differently on PPC and Intel -- using an older version of gcc on PPC (for 10.3 compatibility maybe?). Anyway, it was a mess, but we fixed it by compiling the extension separately with a bunch of different flags, then lipo-ing the two binaries together. Could anything funky like that be going on here? Could be -- you can check the Makefile to get a look at the flags I am using and let me know if you have any suggestions http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/release/osx/Makefile?view=markup JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] different PNG and PDF output...
On Tue, Dec 16, 2008 at 7:06 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: ps. John, are you releasing a new maintenance version? I'm afraid that my previous patch broke one of the example. Sorry, I thought the fix was obvious and didn't pay much attention. Yes, and I had just completed a round of testing when I saw your patch come in and included it w/o further testing (stupid). In any case, there are still a couple of bug fixes and optimizations that are in progress, and I will continue to push these out as they become available. The tarball and OSX binaries will soon be almost fully automated, and when we stabilize the 98.5 branch, Charlie can post an update to the win32 binaries. I plan to cut another bugfix release tomorrow in any case. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Correct usage of Mpl backend...
On Mon, Dec 15, 2008 at 6:20 AM, vehemental jimmy.pail...@gmail.com wrote: The program is working as expected...except memory wise...the program keeps growing... each time plot is pressed it's growing...I believe it's due to some poor programming on my side, but I can't really put my finger on it right now. I suspect that I have 2 competing mainloop maybe but i' m not really sure By default matplotlib overplots, so every time you call plot a new line is added to the canvas. You can turn this behavior off using the hold method ax.hold(False) or setting the axes.hold rc parameter -- see http://matplotlib.sourceforge.net/users/customizing.html JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Correct usage of Mpl backend...
On Mon, Dec 15, 2008 at 9:44 AM, John Hunter jdh2...@gmail.com wrote: By default matplotlib overplots, so every time you call plot a new line is added to the canvas. You can turn this behavior off using the hold method Sorry, on second look it appears you have a more serious problem. Typically you want to create your figure and canvas just once and add it to your GUI. And then when the user clicks plot, just draw to the existing axes def __init__(): self.figure = some code self.canvas = some code self.axes = some code def onclick(self): self.axes.cla() # clear if you want self.axes.plot(something) Ie, you want to reuse the same figure/canvas/axes instead of recreating them all the time -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error installing matplotlib 0.98.5
On Mon, Dec 15, 2008 at 9:45 AM, Alexander Chemeris alexander.cheme...@gmail.com wrote: I experience the same problem. Full shell session (of one command ;) is following: ~$ sudo easy_install matplotlib Searching for matplotlib Reading http://pypi.python.org/simple/matplotlib/ Reading http://matplotlib.sourceforge.net Reading https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194 Reading https://sourceforge.net/project/showfiles.php?group_id=80706package_id=82474 Reading http://sourceforge.net/project/showfiles.php?group_id=80706 Best match: matplotlib 0.98.5 Downloading http://downloads.sourceforge.net/matplotlib/matplotlib-0.98.5.tar.gz?modtime=1229034572big_mirror=0 Processing matplotlib-0.98.5.tar.gz Running matplotlib-0.98.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-fpPLdN/matplotlib-0.98.5/egg-dist-tmp-0LZ25S ...snip error: lib/matplotlib/mpl-data/matplotlib.conf.template: No such file or directory Exception exceptions.OSError: (2, 'No such file or directory', 'src/image.cpp') in bound method CleanUpFile.__del__ of setupext.CleanUpFile instance at 0x2fd7d40 ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/path.cpp') in bound method CleanUpFile.__del__ of setupext.CleanUpFile instance at 0x2fd7200 ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/backend_agg.cpp') in bound method CleanUpFile.__del__ of setupext.CleanUpFile instance at 0x2fd7b90 ignored I can replicate it too, and I think I am getting some insight into what is going on and it may point to a distutils and/or easy_install bug (but one we can work around). The file in question is matplotlib.conf.template, which exists in lib/matplotlib/mpl-data. There is a symlink in doc/mpl_data which points to lib/matplotlib/mpl-data. Eg in the mpl src tree:: jdhun...@bic128:mpl ls -ld lib/matplotlib/mpl-data/ doc/mpl_data lrwxrwxrwx 1 jdhunter jdhunter 27 Jun 2 2008 doc/mpl_data - ../lib/matplotlib/mpl-data/ drwxrwxr-x 6 jdhunter jdhunter 4096 Dec 10 13:09 lib/matplotlib/mpl-data/ Now create the sdist:: jdhun...@bic128:mpl python setup.py sdist sdist.out jdhun...@bic128:mpl grep matplotlib.conf.template sdist.out hard linking doc/mpl_data/matplotlib.conf.template - matplotlib-0.98.5/doc/mpl_data hard linking lib/matplotlib/mpl-data/matplotlib.conf.template - matplotlib-0.98.5/lib/matplotlib/mpl-data If we create an sdist, the symlink is backwards: the tarball says lib/matplotlib/mpl-data/matplotlib.conf.template links to doc/mpl_data/matplotlib.conf.template and has zero content jdhun...@bic128:tmp tar tvfz matplotlib-0.98.5.tar.gz |grep matplotlib.conf.template -rw-r--r-- cmoad/staff 13838 2008-12-09 17:53 matplotlib-0.98.5/doc/mpl_data/matplotlib.conf.templatehrw-r--r-- cmoad/staff 0 2008-12-09 17:53 matplotlib-0.98.5/lib/matplotlib/mpl-data/matplotlib.conf.template link to matplotlib-0.98.5/doc/mpl_data/matplotlib.conf.template If you unpack the tarball using a standard incantation, a copy is made:: jdhun...@bic128:tmp tar xfz matplotlib-0.98.5.tar.gz jdhun...@bic128:tmp cd matplotlib-0.98.5/ jdhun...@bic128:matplotlib-0.98.5 ls -ld doc/mpl_data/matplotlib.conf.template lib/matplotlib/mpl-data/matplotlib.conf.template -rw-r--r-- 2 jdhunter jdhunter 13838 Dec 9 17:53 doc/mpl_data/matplotlib.conf.template -rw-r--r-- 2 jdhunter jdhunter 13838 Dec 9 17:53 lib/matplotlib/mpl-data/matplotlib.conf.template I think what may be happening is that setuptools are reading the tarball using the python tarfile reader and the link is getting botched. However, I can read the missing file using tarfile:: In [17]: import tarfile In [18]: t = tarfile.open('dist/matplotlib-0.98.5.tar.gz') In [19]: o = t.extractfile('matplotlib-0.98.5/lib/matplotlib/mpl-data/matplotlib.conf') In [20]: s = o.read() In [21]: print s[:80] # MPLConfig - plaintext (in .conf format) # This is a sample matplotlib configu So I am not sure exactly what is going wrong but I think broken handling of the link is playing a role. I will probably work around this by removing the links and making hard copies myself before building the sdist and eggs, unless I hear something more intelligent from someone or come up with something better. -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imshow with pdf
On Mon, Dec 15, 2008 at 11:04 AM, Jouni K. Seppänen j...@iki.fi wrote: The (812 pixels high) image has been embedded in a png of height 617, but in the pdf file it has height 446. 446/617 is about .72, so the problem must be that the pdf backend forces the dpi to 72, while the png file is being saved with dpi=100. There is a TODO comment in the pdf backend about figure resolution that I added in February but never got around to fixing. I'll take a closer look at this later. Thanks for looking into this Jouni -- please make sure to fix in the branch and merge to the trunk, as described in http://matplotlib.sourceforge.net/devel/coding_guide.html#using-svnmerge -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug in ubuntu intrepid
On Mon, Dec 15, 2008 at 12:22 PM, Alejandro Weinstein alejandro.weinst...@gmail.com wrote: Hi: Is anybody aware of the MPL bug on Ubuntu intrepid? https://bugs.launchpad.net/ubuntu/+source/matplotlib/+bug/299381 Thanks for the head's up -- I posted a comment with a suggestion about what may be going on. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] figimage and image magnification (was: imshow with pdf)
On Mon, Dec 15, 2008 at 2:21 PM, Jouni K. Seppänen j...@iki.fi wrote: John Hunter jdh2...@gmail.com writes: I'll take a closer look at this later. Thanks for looking into this Jouni -- please make sure to fix in the branch and merge to the trunk, as described in http://matplotlib.sourceforge.net/devel/coding_guide.html#using-svnmerge I have a patch (attached) that fixes this case but breaks figimage. It seems to me that the bug is in figimage, but with the current pdf backend (which forces dpi=72 for all images) it happens to work right. I'm a little wary of making this change on the maintenance branch without also fixing figimage, and I don't really know how to fix figimage. The bug in the pdf backend is that it forces dpi=72, because in PDF 1.4 there are always 72 points to an inch. (In some later versions the scale can be changed, but never mind that for now.) This is a problem because sometimes people want to have their figures at a higher resolution. The attached patch adds an image_dpi variable to the pdf backend and uses it like the ps backend does: get_image_magnification() returns image_dpi/72.0, and the width and height of images are divided by this magnification factor. I am not sure what figimage should mean for a vector backend so I want to hear from Perry who motivated the function. When I implemented it on his original request, I understood it to be a raw pixel dump to the canvas with no scaling, no interpolation, etc What does a pixel dump to a canvas mean for a vector backend? I think we could define something that was at least consistent, but we should probably hear from Perry et al who are presumably using the function. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error installing matplotlib 0.98.5
On Mon, Dec 15, 2008 at 2:49 PM, Mauro Cavalcanti mauro...@gmail.com wrote: 'src/backend_agg.cpp') in bound method CleanUpFile.__del__ of setupext.CleanUpFile instance at 0x874ab2c ignored But everthing seems to be working OK, as I tested my application with the newly installed version and it runs without crashes. Yes, this is the cruft I referred to earlier in my email. distutils is putting copies of all our _somefile.cpp into the tarball as somefile.cpp (leading underscore stripped). I'm attaching my post to the distutils-sig mailing list just in case anyone here has any insight. I think the warnings are harmless, but they are irritating distutils-sig post I am seeing some strange behavior in files with leading underscores. I have some python extension code with names like:: src/_somefile.cpp and in my sdist they are being added in duplicate, one with the leading underscore removed. src/somefile.cpp src/_somefile.cpp This is causing easy_setup to complain at the end about not being able to remove certain files. jdhun...@bic128:mpl98.5 find . -name backend_agg.cpp jdhun...@bic128:mpl98.5 find . -name _backend_agg.cpp ./src/_backend_agg.cpp jdhun...@bic128:mpl98.5 python setup.py sdist sdist.out jdhun...@bic128:mpl98.5 grep backend_agg.cpp sdist.out copying src/_backend_agg.cpp - matplotlib-0.98.5.1/src copying src/backend_agg.cpp - matplotlib-0.98.5.1/src When I run easy_install on the src tarball, I then get:: Installed /home/jdhunter/devez/lib/python2.5/site-packages/matplotlib-0.98.5.1-py2.5-linux-x86_64.egg Processing dependencies for matplotlib==0.98.5.1 Finished processing dependencies for matplotlib==0.98.5.1 Exception exceptions.OSError: (2, 'No such file or directory', 'src/image.cpp') in bound method CleanUpFile.__del__ of setupext.CleanUpFile instance at 0x29bb440 ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/path.cpp') in bound method CleanUpFile.__del__ of setupext.CleanUpFile instance at 0x29ba8c0 ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/backend_gdk.c') in bound method CleanUpFile.__del__ of setupext.CleanUpFile instance at 0x7fe8fa2ee998 ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/backend_agg.cpp') in bound method CleanUpFile.__del__ of setupext.CleanUpFile instance at 0x29bb290 ignored Using the standard distutils with python 2.5.1 -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] New OSX installers (beta)
I *think* I may have figured out what is causing some of the dynamic linkage problems several of you have reported on our OSX installers. I have build a new egg snapshot, and better yet, and new binary mpkg installer for OSX. Give them a try: http://matplotlib.sourceforge.net/snapshots/matplotlib-0.98.5-py2.5-macosx10.5.zip (binary package installer) http://matplotlib.sourceforge.net/snapshots/matplotlib-0.98.5_r0-py2.5-macosx-10.3-fat.egg (binary egg) and let me know if these fix the problems you all are having. Fingers crossed, JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fuzzy plots of ode solutions
On Sat, Dec 13, 2008 at 9:38 AM, John Hunter jdh2...@gmail.com wrote: My guess is that you may be seeing the antialiasing of your pdf renderer. matplotlib has a pretty good antialiasing renderer for the screen display (antigrain) but your mileage may vary for your pdf renderer. Since pdf is a vector output, we have no control over the renderering. What pdf viewer are you using? The best way for us to see what you are seeing is to take a PNG screenshot of your PDF file displayed in your viewer and then post the PNG. Ie, here is what I am seeing in the Preview app: the fuzziness is from the antialiasing, but I am used to seeing this. One more thought -- you should be able to turn off the antialiased property, eg with plot(x, y, antialiased=False) Unfortunately, I poked into our backend_pdf and it appears this property is ignored. Jouni: is there a way to turn off antialiasing in PDF, and could we add support for this in the backend? Thanks, JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with matplotlib-0.98.5-py2.5-macosx-10.3.egg
On Sat, Dec 13, 2008 at 3:01 PM, Robin robi...@gmail.com wrote: As in my other mail I am having trouble building from source. Previously I used the mac .egg to get around this, but the matplotlib-0.98.5-py2.5-macosx-10.3.egg for 0.98.5 doesn't appear to work. I think the egg may be broken. Try grabbing the tarball and following the instructions at http://ipython.scipy.org/moin/Py4Science/InstallationOSX or http://ipython.scipy.org/moin/MatplotlibOSXBuildNotes I will see if we can do something about the os x egg situation, but the above may be the path of least resistance right now. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] use of del() to delete a line
On Thu, Dec 11, 2008 at 7:56 AM, TP [EMAIL PROTECTED] wrote: TP wrote: I have a question about the behavior of del() Python built-in. Ok, del only removes a name from the local namespace. I have found an old answer of John, below. It seems that a better solution is to use the remove method of a line instance: http://osdir.com/ml/python.matplotlib.general/2005-05/msg00045.html Until now, I used del which works well when the complete object hierarchy is given... The line is stored in axes.lines list, so simply deleting it will not work because there is a reference to it in the list. You need to remove it from the list, as you inidicate. See also http://matplotlib.sourceforge.net/users/artists.html -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] when the same Line2D is plot on two subplots, it disappears on the two subplots
On Thu, Dec 11, 2008 at 10:19 AM, TP [EMAIL PROTECTED] wrote: Hi, I use matplotlib 0.91.2. When I plot the same Line2D on two subplots, it disappears: execute the following script: ### from pylab import * ion() f = figure() s = f.add_subplot(211) curve = matplotlib.lines.Line2D([0,1],[0,1],color='m') s.add_line( curve ) s2 = f.add_subplot(212) draw() raw_input('press a key to delete a line to second subplot') s2.add_line( curve ) s2.lines[-1].figure.canvas.draw() print s2.lines[-1].get_visible() raw_input('press a key to quit') ### What is the reason for this behavior? The lines get their transforms from the axes they reside in -- you can't share a line on multiple axes -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ANN: matplotlib-0.98.4
We have just released a new version of matplotlib, available for download at https://sourceforge.net/project/showfiles.php?group_id=80706package_id=278194release_id=646146 These what's new release notes, with graphs and links, are available in html at http://matplotlib.sourceforge.net/users/whats_new.html Thanks to Charlie Moad for testing and preparing the source release, including binaries for OS X and Windows for python 2.4 and 2.5 (2.6 and 3.0 will not be available until numpy is available on those releases). Thanks to the many developers who contributed to this release, with contributions from Jae-Joon Lee, Michael Droettboom, Ryan May, Eric Firing, Manuel Metz, Jouni K. Seppaenen, Jeff Whitaker, Darren Dale, David Kaplan, Michiel de Hoon and many others who submitted patches What new in 0.98.4 == It's been four months since the last matplotlib release, and there are a lot of new features and bug-fixes Legend enhancements Jae-Joon has rewritten the legend class, and added support for multiple columns and rows, as well as fancy box drawing. See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.legend.Legend http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo3.html Fancy annotations and arrows - Jae-Joon has added lot's of support to annotations for drawing fancy boxes and connectors in annotations. See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.annotate http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.BoxStyle http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.ArrowStyle http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.patches.ConnectionStyle http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html Native OS X backend Michiel de Hoon has provided a native Mac OSX backend that is almost completely implemented in C. The backend can therefore use Quartz directly and, depending on the application, can be orders of magnitude faster than the existing backends. In addition, no third-party libraries are needed other than Python and NumPy. The backend is interactive from the usual terminal application on Mac using regular Python. It hasn't been tested with ipython yet, but in principle it should to work there as well. Set 'backend : macosx' in your matplotlibrc file, or run your script with:: python myfile.py -dmacosx psd amplitude scaling - Ryan May did a lot of work to rationalize the amplitude scaling of :func:`~matplotlib.pyplot.psd` and friends. The changes should increase MATLAB (TM) compatabililty and increase scaling options. http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.psd http://matplotlib.sourceforge.net/examples/pylab_examples/psd_demo2.html#pylab-examples-psd-demo2 http://matplotlib.sourceforge.net/examples/pylab_examples/psd_demo3.html#pylab-examples-psd-demo3 Fill between -- Added a fill_between function to make it easier to do shaded region plots in the presence of masked data. You can pass an *x* array and a *ylower* and *yupper* array to fill betweem, and an optional *where* argument which is a logical mask where you want to do the filling. See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.fill_between http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between.html Lots more --- Here are the 0.98.4 notes from the CHANGELOG:: Added mdehoon's native macosx backend from sf patch 2179017 - JDH Removed the prints in the set_*style commands. Return the list of pprinted strings instead - JDH Some of the changes Michael made to improve the output of the property tables in the rest docs broke of made difficult to use some of the interactive doc helpers, eg setp and getp. Having all the rest markup in the ipython shell also confused the docstrings. I added a new rc param docstring.harcopy, to format the docstrings differently for hardcopy and other use. Ther ArtistInspector could use a little refactoring now since there is duplication of effort between the rest out put and the non-rest output - JDH Updated spectral methods (psd, csd, etc.) to scale one-sided densities by a factor of 2 and, optionally, scale all densities by the sampling frequency. This gives better MatLab compatibility. -RM Fixed alignment of ticks in colorbars. -MGD drop the deprecated new keyword of np.histogram() for numpy 1.2 or later. -JJL Fixed a bug in svg backend that new_figure_manager() ignores keywords arguments such as figsize, etc. -JJL Fixed a bug that the handlelength of the new legend class set too short when numpoints=1 -JJL Added
Re: [Matplotlib-users] Anyone see this after upgrading?
On Wed, Dec 10, 2008 at 5:01 PM, Ryan Wagner [EMAIL PROTECTED] wrote: Just upgraded to 98.4. Can reproduce this on two XP32 boxes. Any thoughts? This is a bug in the win32 installer, which has gtkagg set as the default backend. You can fix this by setting TkAgg in the backend, which is what we *should* have done in the installer. You need to change the line backend : GTKAgg to backend : TkAgg in your matplotlibrc config file. Instructions for editing the rc file can be found at http://matplotlib.sourceforge.net/users/customizing.html. You can also read about what is a backend? here - http://matplotlib.sourceforge.net/faq/installing_faq.html#id1 We will be putting out new installers that fix this problem ASAP, so those of you who on windows who have not yet installed 98.4 may prefer to wait until we announce the fixed installers are up. This problem does not affect the src tarball or the os x installers. Sorry for the trouble! JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] blit example on MacOS with ipython
On Wed, Dec 10, 2008 at 5:20 PM, pierre garrigues [EMAIL PROTECTED] wrote: # create the initial line x = np.linspace(-3, 3, 1000) line, = plt.plot(x, np.sin(x), animated=True) # save the clean slate background -- everything but the animated line # is drawn and saved in the pixel buffer background background = canvas.copy_from_bbox(ax.bbox) It looks to me that you need to force a figure draw *before* doing copy_from_bbox. Eg:: fig.canvas.draw() background = canvas.copy_from_bbox(ax.bbox) The reason you are seeing a difference between ipython run and ipython copy-and-paste is that in run mode ipython turns interactive drawing off (for details see http://matplotlib.sourceforge.net/users/shell.html) so the draw event is never called, and the cached renderer, which is triggering your exception, is never set. This is speculation, as I haven't tested, so please answer back if this fixes your problem and if so I will update the matplotlib animation recipe which also suffers from this problem (which is not exposed unless you are running in interactive mode, which you are). It is on my list of things to do to write a proper animation chapter for the user's guide JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MPL colors
On Tue, Dec 9, 2008 at 1:01 PM, Mauro Cavalcanti [EMAIL PROTECTED] wrote: Dear ALL, MPL accepts several formats for passing color information for the plotting methods (plot, xlabel, ylabel, etc.) and these are well documented. The set_color() and other methods in matplotlib.Lines.Line2D accept all these formats, but I could not figure out how to retrieve the current color of a plot using the get_color() method in a format other than the 'b', 'r', 'g', etc. predefined color symbols! I would instead like to be able to retrieve the current color in RGB hex or HTML format. Is it possible? Yep, we have a color converter for that -- it recognizes any mpl color string and returns rgba: In [72]: from matplotlib.colors import colorConverter In [73]: colorConverter.to_rgba('b') Out[73]: (0.0, 0.0, 1.0, 1.0) In [74]: colorConverter.to_rgba('blue') Out[74]: (0.0, 0.0, 1.0, 1.0) -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
On Mon, Dec 8, 2008 at 9:10 AM, Fago, Matt - AES [EMAIL PROTECTED] wrote: So what is to be done here? It seems to me that at least the factor of two should be fixed for one-sided PSDs, and the 1/fs normalization difference with Matlab documented. Ideally, I'd think this normalization would be on by default, with the option to turn it off. Are you planning to submit a patch, or shall I look into it? If I submit a patch, does matplotlib require a copyright assignment? If you submit a patch, we assume you are agreeing to the mpl licensing terms, so you do not need to explicitly do anything. As for the decision about how the defaults and kwargs should behave, I'll defer to you and Ryan. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
On Mon, Dec 8, 2008 at 10:56 AM, Ryan May [EMAIL PROTECTED] wrote: My only other concern is whether this belongs in 0.98.x. This is a behavior change from 0.98.3, not necessarily a bug fix. I'll defer to John, et al. on whether this should go in 0.98.x or go in a later release. It's a judgement call, but we have always had new features and minor API changes in the point releases. Except on the 0.91 maintenance branch, which is only bugfix, we have continuously added new stuff on every release. When the breakage is likely to be difficult, or the new feature really significant, we will push the major version. I don't think these changes are so significant that they require waiting until a new major version number, but you may want to consider issuing a warning in addition to the requisite explanation in the docstring and CHANGELOG. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] using color as z-axis for plots
On Mon, Dec 8, 2008 at 12:45 PM, Chad Kidder [EMAIL PROTECTED] wrote: I've got many series of data that I want to plot, and each has an additional scalar that is valid for the whole series. What I want to do is plot all these series on top of each other (plot can do this just fine), but with the additional scalar changing the color, efectively using color as the z-axis. I'm not seeing how to do that. If there was a function where I could give a color map a value and it would spit out the color, that would work, but I haven't seen it. Thanks for your help. Check out the scatter_demo -- scatter takes an optional argument 'c' for the color and an optional colormap http://matplotlib.sourceforge.net/users/screenshots.html#scatter-demo --Chad Kidder -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] fancy patch formatting breaking tex document
In the Curve class of patches.py, where we are doing: _style_list[-] = Curve and interpolating this into a rest table via patches._pprint_styles, which looks like this:: == = Class Name Attrs == = Curve -None CurveB - head_length=0.4,head_width=0.2 BracketB -[ widthB=1.0,lengthB=0.2,angleB=None CurveA - head_length=0.4,head_width=0.2 CurveAB- head_length=0.4,head_width=0.2 Fancy fancyhead_length=0.4,head_width=0.4,tail_width=0.4 Simple simple head_length=0.5,head_width=0.5,tail_width=0.2 Wedge wedgetail_width=0.3,shrink_factor=0.5 == = tex is inserting the following into the tex doc:: Curve \begin{itemize} \item {} \end{itemize} None \\ It looks like it thinks the hyphen is starting an itemize list, and this is breaking the tex table environment. Any ideas how to fix this? For now, I am going to quote the Name column with single quotes, eg '-' and '-' Thanks, JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib and Python 3
On Thu, Dec 4, 2008 at 8:42 PM, David Cournapeau [EMAIL PROTECTED] wrote: Quick question. Is matplotlib python 3 compatible? Has anyone switched to python 3? Anecdotally, how much of a pain is it to switch over, if you use common scientific libraries such as PIL and VTK? matplotlib depends on numpy, and numpy on python 3 won't be finished anytime soon - it will be a huge task. mpl also depends on CXX for extension code. I was heartened to see that the python 3 migration is well underway in CXX svn. Since this is most of our extension code, hopefully it will insulate from serious difficulties porting the extension code. But we will have to wait for CXX and numpy before we can do serious work. JDH -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] unexpected keyword argument error while running legend_demo3.py
On Wed, Dec 3, 2008 at 9:15 AM, Nitin Bhide [EMAIL PROTECTED] wrote: Hi, I am getting following error while running the 'legend_demo3.py' from the examples. exec codeObject in __main__.__dict__ File D:\nitinb\SoftwareSources\SVNPlot\legendtest.py, line 13, in module ax1.legend(loc=1, ncol=3, shadow=True) File F:\Python25\Lib\site-packages\matplotlib\axes.py, line 3617, in legend self.legend_ = mlegend.Legend(self, handles, labels, **kwargs) TypeError: __init__() got an unexpected keyword argument 'ncol' I am using ActivePython version 2.5.2 and Matplotlib version 0.98.3 We use the svn version of matplotlib to generate the website, and ncol is a recent feature not in the main release yet. You can checkout the svn code following the instructions at http://matplotlib.sourceforge.net/devel/coding_guide.html I have added a note on the gallery warning people that not all the images are available in the latest release with a pointer to the svn instructions. But we would like to get a release out ASAP! JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pylab or not... crashes or not
On Tue, Dec 2, 2008 at 12:09 PM, Eric Emsellem [EMAIL PROTECTED] wrote: Really annoying but as mentioned before, I cannot get a set of commands which consistenly break the session, so... Since there does not appear to be an easy diagnosis or fix, you may want to consider switching your backend to the non-threaded tkagg JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot with drop shadow
On Mon, Dec 1, 2008 at 9:17 AM, Nate [EMAIL PROTECTED] wrote: Is there a way to plot lines with drop shadows? Nothing built-in -- but you can fake it:: import matplotlib.pyplot as plt import numpy as np t = np.arange(0.0, 2.0, 0.01) s = np.sin(2*np.pi*t) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(t+0.01, s-0.01, color='gray', lw=2) ax.plot(t, s, color='blue', lw=3) plt.show() JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pylab or not... crashes or not
On Mon, Dec 1, 2008 at 1:08 PM, Eric Emsellem [EMAIL PROTECTED] wrote: Hi this may be a known problem (didn't find anything on this issue) but here it is: - when I start a session with ipython -pylab I often get crashes with my session. When I mean often, it means really often like once everything 1/2h or so. A crash means that the command I just sent gets stuck and the only way for me to get it back is to kill the PID of the ipython process... The problem is that it is almost impossible to reproduce a systematic behaviour there so I cannot really send you a list of commands which results in a crash. It just happens (often). However, after someone suggested it, I now enter Ipython by a simple ipython and do immediately from pylab import *. And then I have NO crashes whatsoever. any suggestion there? Is that normal? It is definitely not normal -- it almost never happens to me. Does it help if you run TkAgg instead of GTKAgg. Are you importing/using anything else when this is happening? What version of numpy are you running? - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot with drop shadow
On Mon, Dec 1, 2008 at 2:43 PM, twentypoundtrout [EMAIL PROTECTED] wrote: So there is no way to say plot a line. Grab that image. Apply a standard SVG filter (like Gaussian). And overlay the blur? I do not know the PIL well enough to know if this is feasible. You can do this using an external program -- see for example http://abitofpythonabitofastronomy.blogspot.com/2008/10/svg.html. It would be challenging to implement something like this internally across output formats I think, but we recently added some features to make it easier to use an svg editor for filtering mpl objects. See also this thread http://www.nabble.com/SVG-clickable-images-td20236869.html#a20236869 JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib PSD bug?
On Mon, Dec 1, 2008 at 3:40 PM, Andrew Straw [EMAIL PROTECTED] wrote: I appreciate the work you're doing on this, and while I don't have any very strong opinions on the API questions you raise, I would request that you include in the docstrings information at least at the level of the above, listing the scaling issue, the sources you've followed and how and why you've chosen to follow them or deviate, and differences with the default behavior of other software. I recently helped a colleague use Matlab's PSD/pwelch functions and had to spend some time sending in sine waves of various frequencies and amplitudes to figure out what the results meant. If matplotlib gives different results by default, I think it should 1) justify why and 2) indicate what option(s) may be set to get results equivalent to other systems, including Matlab. My preference is to strive for matlab compatability here. I am pretty sure it was compatible with matlab in my original tests to several significant digits, but I no longer have the test code and my memory is fuzzy because it was over 5 years ago. But I intended this function to be matlab compatible, and if it is not I would prefer to see it compatible even if it means breaking some existing code. It is possible that the original code did not scale with sampling frequency and was compatible, but over time we've made enhancements that broke compatibility. Its been a long time since I used and tested against matlab. If there is good reason to add support for an alternate scaling, we can easily support it with kwargs. But since the signature and origins of this function were matlab compatibility, I think it is least confusing if the default output has similar scaling. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting a matplotlib.lines.Line2D instance directly
On Sat, Nov 29, 2008 at 6:48 AM, TP [EMAIL PROTECTED] wrote: Hi everybody, In my own application, I want to specialize matplotlib.lines.Line2D to be able to deal with units. Concerning this class, is there a direct means to plot instances? For example, if I do: a=matplotlib.lines.Line2D([5,6],[7,8],color='m') You can add it directly to the Axes/Subplot instance with ax.add_line(a) See also the http://matplotlib.sourceforge.net/examples/pylab_examples/clippedline.html example which shows how to create a custom, derived line class. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting a list of lines
On Thu, Nov 27, 2008 at 11:21 AM, Mauro Cavalcanti [EMAIL PROTECTED] wrote: Then, in a checkbox event, I do the following: index = event.GetSelection() plot = self.plot_list[index] if self.FileList.IsChecked(index): plot[0].set_visible(True) else: plot[0].set_visible(False) This works quite well and points are properly toggled on/off the Basemap. But then I want to plot minimum spanning trees connecting the point datasets. For this I do: n = len(nodes) for i in range(n): try: t = edges[i,0]-1 u = edges[i,1]-1 x = [nodes[t,0], nodes[u,0]] y = [nodes[t,1], nodes[u,1]] self.plot_list.append(map.ax.plot(x,y,'-b')) except: continue where nodes is the array of point coordinates and edges are the from/to indexes of the coordinates, computed with Prim's algorithm. The lines between points (representing the minimum spanning tree) are displayed OK. But then my problem appears: I cannot find a way to turn the entire tree (which is composed of n-1 line segments) on and off of the map in the same way I do with the points (as shown above). What I would like is to store all line segments inside the for loop, and then show the tree at once, outside the loop; so I could use the same plot[0].set_visible(True|False) I use for the points. Hi Mauro, Yes, you should be able to use a collection for this quite easily. One comment first. You never want to try/except and catch all exceptions w/o handling them in some way. If you want to catch a specific exception, fine, or of you want to catch all of them and log them and then reraise, also fine, but there is not good use case for catching them all and then continuing silently. Now, on to collections. In your example above, you would simply do:: segments = [] n = len(nodes) for i in range(n): t = edges[i,0]-1 u = edges[i,1]-1 xt, yt = nodes[t,0], nodes[t,1] # assuming xt, yt are scalars here xu, yu = nodes[u,0], nodes[u,1] segments.append( [ (xt,yt), (xu,yu) ] ) collection = collections.LineCollection(segments) and later:: collection.set_visible(True|False) # etc... Hope this helps, JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar
On Tue, Nov 25, 2008 at 2:40 PM, Drain, Theodore R [EMAIL PROTECTED] wrote: Michael, I think the issue is that there is no Unicode in the script that was attached - it's just a simple polar call so the user isn't really Unicode. I think Unicode is starting to creep into the source in various places - we just had a user point out that negative numbers are using a normal negative sign ('-1.2') anymore but some kind of Unicode dash that's a lot bigger than the normal one. I wonder if this could be related... (If it matters, most of our users would rather have just the regular negative sign and not embedded Unicode in the axis labels - it looks wrong to them and makes doing any kind of processing of axis labels more difficult). This was supposed to be a feature not a bug. As far as I understand, we are now using the proper minus sign which has the same width as the horizontal part or a plus sign. See http://en.wikipedia.org/wiki/Plus_sign#Plus_sign in the section Character codes. The hyphen, which doubles as a minus sign in the ascii character set, is not the proper character for typesetting. I don't think this is the problem Nils is having, because the character code for the minus sign is different (and in the formatter, we explicitly convert this if usetex is True) in the ScalarFormatter.fix_minus method. If the unicode minus is sufficiently problematic for you, I can add an rc param. Something like axis.unicode_minus : True The problem here appears to be in matplotlib.projects.polar.ThetaFormatter.__call__, which uses the degree symbol. I think all we need to do is return the proper tex string in this case. Michael, does this look right to you: def __call__(self, x, pos=None): # \u00b0 : degree symbol if rcParams['text.usetex'] and not rcParams['text.latex.unicode']: return r$%d^\circ$ % ((x / npy.pi) * 180.0) else: return u%d\u00b0 % ((x / npy.pi) * 180.0) - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] polar
On Tue, Nov 25, 2008 at 3:16 PM, John Hunter [EMAIL PROTECTED] wrote: If the unicode minus is sufficiently problematic for you, I can add an rc param. Something like axis.unicode_minus : True Added as rc param 'axes.unicode_minus' in svn r6453 with example examples/api/unicode_minus.py But I definitely second Michael's suggestion -- you don't want to be parsing ticklabels if you don't have too! JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problems with, LaTeX symbols, axes rescaling
On Mon, Nov 24, 2008 at 6:23 PM, Zane Selvans [EMAIL PROTECTED] wrote: whether it's just the fact that I'm using the SVN code. The first thing I noticed is that all of the LaTeX symbols I have in my plots are now messed up. I could see this being a font issue... does anyone know how/where Matplotlib gets pointed at the LaTeX fonts? And how I would check to see where it's looking, or whether it's not finding what it's looking for? I'm not getting any errors - my greek letters just cease to be greek, and various text decorations (like \bar{D}) come out as other things altogether (like D, only with an Angstrom symbol over it...). I suggest completely wiping your .matplotlib directory (saving only your matplotlibrc if you have customized it). matplotlib caches a fair amount of font and latex rendering stuff. I had a similar problem on an upgrade with mathtext. We are not sure why it is happening yet, but it will probably go away if you rm -rf ~/.matplotlib. Also, wipe your site-packages/matplotlib dir before installing. See http://matplotlib.sourceforge.net/faq/installing_faq.html#cleanly-rebuild-and-reinstall-everything To get more verbose information about what mpl is doing behind the scense, run with python myscript.py --verbose-debug You can use --verbose-helpful for less output. I think it might be a good idea for us to start using a versioned dir structure for the cached data... JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problems with, LaTeX symbols, axes rescaling
On Mon, Nov 24, 2008 at 8:37 PM, Zane Selvans [EMAIL PROTECTED] wrote: On Nov 24, 2008, at 5:23 PM, John Hunter wrote: The first thing I noticed is that all of the LaTeX symbols I have in my plots are now messed up. I could see this being a font issue... does anyone I suggest completely wiping your .matplotlib directory (saving only your matplotlibrc if you have customized it). matplotlib caches a Thanks, this fixed it! Though, futzing with the LaTeX settings in the new matplotlibrc it appears that something about how/when it chooses when to format as tex has changed. If text.usetex is True, text in my labels and titles that is enclosed within $$'s gets typeset as tex, but apparently *all* of the xtick labels get set as mathtext - they're in the light/thin and slightly more difficult to read LaTeX font, and in my Basemap figures, the NSEW modifiers on the text objects indicating lat/lon direction are all italicised, as they would be were they enclosed in $$'s. I don't seem to be able to get the relatively bold, sans-serif tick labels, while still preserving the ability to typeset math in my labels and titles... We have two modes to render latex -- one is native TeX layout and uses latex and dvipng, and is superior if you need all of TeX's capabilities (eg an eqnarray), but the fonts are suboptimal. The other is mathtext, which will cover 98% of most users' math needs, does not require a latex install because it is pure mpl, and uses nicer fonts . The docs are here: mathtext: http://matplotlib.sourceforge.net/users/mathtext.html usetex: http://matplotlib.sourceforge.net/users/usetex.html I strongly encourage using mathtext over usetex, unless you need some of the hairy stuff from TeX. (An aside: how does one go about decorating the Text objects that label the ticks? I frequently have an axis whose units are degrees, and I'd rather just be able to append a $^\circ$ on the end of the text for the ticks, rather than have to say in the axis label [degrees].) Use a custom formatter. I'm freestyling here, so check the examples linked to below import matplotlib.ticker as ticker formatter = ticker.FormatStrFormatter(r'$%1.2f^\circ$') ax.xaxis.set_major_formatter(formatter) The API docs for the tick formatting and locating are here http://matplotlib.sourceforge.net/api/ticker_api.html And code examples matching formatter are here http://matplotlib.sourceforge.net/search.html?q=codex+formatter If I set text.markup to 'tex', instead of 'plain' I get a complaint about it being invalid, with a pointer to a URL that no longer exists to obtain a new matplotlibrc: Bad key text.markup on line 162 in /Users/zane/.matplotlib/matplotlibrc. You probably need to get an updated matplotlibrc file from http://matplotlib.sf.net/matplotlibrc or from the matplotlib source distribution I've updated the code in svn to point to the new location http://matplotlib.sourceforge.net/_static/matplotlibrc See also http://matplotlib.sourceforge.net/users/customizing.html JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] create ListedColormap with different alpha values
On Sun, Nov 23, 2008 at 2:01 AM, Paul Ivanov [EMAIL PROTECTED] wrote: I took a stab at it, how does this look? I also took the liberty of adding alpha to LinearSegmentedColormap and updated its docstring changing two somewhat ambiguous uses of the word 'entry' with 'key' and 'value'. Hey Paul, Thanks for taking this on. I haven't tested this but I read the patch and have some inline comments below. Some additional comments: * the patch should include a section in the CHANGELOG and API_CHANGES letting people know what is different. * you should run examples/tests/backend_driver.py and make sure all the examples still run, checking the output of some of the mappable types (images, scaltter, pcolor...) * it would be nice to have an example in the examples dir which exercises the new capabilities. See also, in case you haven't, http://matplotlib.sourceforge.net/devel/coding_guide.html, which covers some of this in more detail. Thanks again! Comments below: Index: lib/matplotlib/colors.py === --- lib/matplotlib/colors.py(revision 6431) +++ lib/matplotlib/colors.py(working copy) @@ -452,7 +452,7 @@ self._isinit = False -def __call__(self, X, alpha=1.0, bytes=False): +def __call__(self, X, alpha=None, bytes=False): *X* is either a scalar or an array (of any dimension). If scalar, a tuple of rgba values is returned, otherwise @@ -466,9 +466,10 @@ You need to document what alpha can be here: what does None mean, can it be an array, scalar, etc... if not self._isinit: self._init() -alpha = min(alpha, 1.0) # alpha must be between 0 and 1 -alpha = max(alpha, 0.0) -self._lut[:-3, -1] = alpha +if alpha: I prefer to explicitly use if alpha is None, since there are other things that would test False (0, [], '') that you probably don't mean. +alpha = min(alpha, 1.0) # alpha must be between 0 and 1 +alpha = max(alpha, 0.0) You should be able to use np.clip(alpha, 0, 1) here, but we should consider instead raising for illegal alpha values since this will be more helpful to the user. I realize some of this is inherited code from before your changes, but we can improve it while making this patch. +self._lut[:-3, -1] = alpha mask_bad = None if not cbook.iterable(X): vtype = 'scalar' @@ -558,9 +559,10 @@ def __init__(self, name, segmentdata, N=256): Create color map from linear mapping segments -segmentdata argument is a dictionary with a red, green and blue -entries. Each entry should be a list of *x*, *y0*, *y1* tuples, -forming rows in a table. +segmentdata argument is a dictionary with red, green and blue +keys. An optional alpha key is also supported. Each value +should be a list of *x*, *y0*, *y1* tuples, forming rows in a +table. Example: suppose you want red to increase from 0 to 1 over the bottom half, green to do the same over the middle half, @@ -606,6 +608,8 @@ self._lut[:-3, 0] = makeMappingArray(self.N, self._segmentdata['red']) self._lut[:-3, 1] = makeMappingArray(self.N, self._segmentdata['green']) self._lut[:-3, 2] = makeMappingArray(self.N, self._segmentdata['blue']) +if self._segmentdata.has_key('alpha'): +self._lut[:-3, 3] = makeMappingArray(self.N, self._segmentdata['blue']) Is this what you meant? I think you would use 'alpha' rather than 'blue' here, no? self._isinit = True self._set_extremes() @@ -664,11 +668,10 @@ def _init(self): -rgb = np.array([colorConverter.to_rgb(c) +rgba = np.array([colorConverter.to_rgba(c) for c in self.colors], np.float) self._lut = np.zeros((self.N + 3, 4), np.float) -self._lut[:-3, :-1] = rgb -self._lut[:-3, -1] = 1 +self._lut[:-3] = rgba self._isinit = True self._set_extremes() - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Filling between curves conditionally
On Sun, Nov 23, 2008 at 1:26 PM, John Hunter [EMAIL PROTECTED] wrote: http://matplotlib.sourceforge.net/examples/api/fill_where_demo.html The code is much simpler than the fill_between_posneg original example, which I have just removed from svn. The fill between use case is common enough that I decided to make it an axes/pyplot method. No need to use the intermediate mlab.poly_between anymore. fill_between has signature:: fill_between(x, y1, y2=0, where=None, **kwargs) y1 or y2 can be scalars or length x arrays. If where is None, the fill will be make everywhere between y1 and y2. If where is not None, it is a len(x) np boolean array and the fill will happen only where where==True. The examples are all now folded into fill_between.py http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between.html JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] poly_between and time series data
On Thu, Nov 20, 2008 at 10:09 PM, Eric Firing [EMAIL PROTECTED] wrote: Shailesh Kochhar wrote: Hello, I am trying to fill the space below a curve where my x-axis is indexed by time. The matplotlib api documentation and the examples don't touch on this subject and I haven't had much luck trying a few different variations. Here's what I've tried so far, maybe someone can point out what I'm doing wrong. import time import matplotlib.pyplot as plt import matplotlib.mlab as mlab time_strings = [ list of times as strings ] xs = [ date2num(time.strptime(string) for string in time_strings ] ys = [ list of float values ] fig = plt.figure() ax = fig.add_subplot(111) ax.plot_date(xs, ys) xv, yv = mlab.poly_below(0, xs, ys) ax.fill(xv, yv) I think there is a bug in poly_below -- try usin poly_between xv, yv = mlab.poly_between(xs, ys, 0) I've fixed the bug in svn r6429, so you can also use svn if you have access to it. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Moving a patch with the mouse
On Fri, Nov 21, 2008 at 3:31 AM, Søren Nielsen [EMAIL PROTECTED] wrote: Is it possible to change say the centre point of a circle patch and do a redraw? (couldn't find a function in the documentation) or do I have to remove the old patch and plot a new one. I want to bind mouse movement to a function that changes the location of the patch, so that a user can move a patch with the mouse. There is a tutorial on this at http://matplotlib.sourceforge.net/users/event_handling.html JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] create ListedColormap with different alpha values
On Fri, Nov 21, 2008 at 2:45 AM, Simon Kammerer [EMAIL PROTECTED] wrote: After looking at the source of matplotlib.colors, it seems to me that different alpha values are something Colormap is not designed for. Yes, it looks like the colormap only holds the RGB channels, but it also looks fairly straightforward to patch the code to support the fourth channel. Is this something you'd like to tackle? JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting labels for each 'artist' in a basemap
On Thu, Nov 13, 2008 at 10:38 PM, John [H2O] [EMAIL PROTECTED] wrote: Hello, using matplotlib 0.98 with mpl_toolkit Basemap: I'm trying to create a plot with a series of ellipses over a map. I've followed the tutorial, and can create the same figure as shown here: http://matplotlib.sourceforge.net/users/screenshots.html#ellipses I can also create a series of ellipses over a map. Now I am trying to label each circle using the following snippet: for item in ells: #ells is now a tuple in the form: (Ellipse, (x,y)) and (x,y) is the same as for the Ellipse e = item[0] xy = item[1] ax.add_artist(e) e.set_clip_box(ax.bbox) e.set_alpha(.7) pyplot.text(xy[0],xy[1],e.get_label()) however, for some reason it fails. Can someone provide some ideas on what I am doing wrong? Also, is there more direct way to set the plots so that the labels are drawn? Can you post a complete, free-standing example script which replicates the problem and also the output of the script run with --verbose-debug? See http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting labels for each 'artist' in a basemap
On Fri, Nov 21, 2008 at 10:37 AM, Eric Bruning [EMAIL PROTECTED] wrote: Can you post a complete, free-standing example script which replicates the problem import matplotlib.pyplot as plt f=plt.figure() ax=f.add_subplot(111) ax.plot(range(10)) ax.text(-10, 5, 'this one is ok') ax.text(-1202255993.82, 5, 'this one fails') plt.show() and also the output of the script run with --verbose-debug? See attached. OK, thanks. I can replicate this on one machine (on which python is compiled for 32bit) [EMAIL PROTECTED]:~ uname -a SunOS flag 5.10 Generic_118855-15 i86pc i386 i86pc [EMAIL PROTECTED]:~ python -V Python 2.4.5 [EMAIL PROTECTED]:~ gcc --version gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath) [EMAIL PROTECTED]:~ python -c 'import sys; print sys.maxint' 2147483647 but not on another (on which python supports 64 bit) [EMAIL PROTECTED]:unit uname -a Linux bic128.bic.berkeley.edu 2.6.26.6-49.fc8 #1 SMP Fri Oct 17 15:33:32 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux [EMAIL PROTECTED]:unit python -V Python 2.5.1 [EMAIL PROTECTED]:unit gcc --version gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)\ [EMAIL PROTECTED]:unit python -c 'import sys; print sys.maxint' 9223372036854775807 My guess is the transformation is putting this int out of bounds on the 32 bit system triggering an exception in the cxx code. From the exception, it looks like the exception is being set in cxx extension code but is not being raised at the time the exception is set, because there is no reason the iteration over the info should be triggering the exception at that time. I fixed backend agg to raise the proper exception so it is at least less confusing -- it now raises [EMAIL PROTECTED]:~ python test.py Traceback (most recent call last): File test.py, line 9, in ? fig.canvas.draw() File /home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py, line 283, in draw self.figure.draw(self.renderer) File /home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/figure.py, line 767, in draw for a in self.axes: a.draw(renderer) File /home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/axes.py, line 1590, in draw a.draw(renderer) File /home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/text.py, line 496, in draw ismath=self.is_math_text(line)) File /home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py, line 135, in draw_text self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, angle, gc) TypeError: Invalid input arguments to draw_text_image I'm not sure what the desired behavior here is. We could make it fail silently (not plot the text rather than raise) JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Any news on wxMPL ?
On Fri, Nov 21, 2008 at 11:38 AM, Christopher Barker [EMAIL PROTECTED] wrote: massimo sandal wrote: I tried to wrote to Ken McIvor (wxmpl author) about this but received no answer. How long has it been -- he could be on vacation or something. - If wxmpl has been abandoned by its author, is there anyone interested (beyond myself) in continuing its development? Yes -- even if Ken does come back online, I'd like to see wxMPL hosted by the MPL project anyway -- it would be easier to find, and more likely to get tested and patched. Maybe as a toolkit? I'd be happy to host it in the mpl_toolkits dir if someone brings it up to 0.98 and will maintain it. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plotting labels for each 'artist' in a basemap
On Fri, Nov 21, 2008 at 12:26 PM, Eric Bruning [EMAIL PROTECTED] wrote: My preference would be to see the error rather than mysteriously not see text. The latter would be more frustrating to debug - hard to track down. A scientific user should probably know that he's overextending the floating point capability, which was my case. Actually you are overflowing the int. In the backend, we transform everything to pixel space, and the call fails when it tries to initialize an int with the transformed coordinate. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] general matplotlib usage questions
On Thu, Nov 20, 2008 at 7:12 AM, Darren Dale [EMAIL PROTECTED] wrote: You can use the subplot_adjust button on the toolbar for some degree of customization. But in general, it can be a somewhat time consuming to get the layout just right. I think it would be difficult for mpl to determine what the appropriate axes position should be given a certain figure and text size. There is a recipe on the web site for automatically shifting the left side of the subplot over to make room for the ylabels http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels It might be nice to make an option to handle the simple case automatically, to expand or shrink the subplots so the text fits w/o too much padding on any side. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Hiding a subplot
On Thu, Nov 20, 2008 at 8:06 AM, Søren Nielsen [EMAIL PROTECTED] wrote: Hi, I have a canvas with two subplot.. I want to be able to hide on of the subplots by pushing a button and letting the remaining subplot fill the entire canvas. If I use the set_visible(True) parameter I correctly remove one of the subplots.. but the remaining subplot does not fill the canvas.. Anyone have an idea of how to do this? You should be able to use the change_geometry method on the remaining subplot ax2.set_visible(False) ax1.change_geometry(1,1,1) fig.canvas.draw() JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Saving to a file in a specified directory (and creating said directory along the way)
On Thu, Nov 20, 2008 at 10:24 AM, Joshua Lippai [EMAIL PROTECTED] wrote: Hey, I'm working on a project for which I would like to dump data into a file in a specified directory (that doesn't necessarily exist yet). I know matplotlib.mlab.save(fname, X) will only work if I want to save data from an array/list to a file in the current working directory. Is there an easy way using matplotlib to: A) Save a file to a specified directory rather than the current working directory Just specify the full path to the output dir: save('/path/to/my/data.dat') or use the os modules built-in functions for cross-platform path handling: save(os.path.join(outdir, filename)) B) Create a directory I tell it to save to if it doesn;t already exist You can use os.mkdir. mpl svn has a function cbook.mkdirs to recursively make a directory path. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Saving to a file in a specified directory (and creating said directory along the way)
On Thu, Nov 20, 2008 at 11:22 AM, Christopher Barker [EMAIL PROTECTED] wrote: Joshua Lippai wrote: Now that just leaves creating the directory. I like the cbook.mkdirs implementation a lot better than the non-recursive version in os... thanks for the tip! why not os.makedirs() ? Wow, that one went right by me -- somehow missed its existence. Thanks for the pointer... JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] wx backup show figure (WAS: general matplotlib usage questions)
On Thu, Nov 20, 2008 at 1:29 PM, Robin [EMAIL PROTECTED] wrote: On Thu, Nov 20, 2008 at 5:22 PM, Christopher Barker try wxPython -- it's easy to install and works well. Thanks - it does seem nicer (doesn't have the mouse over resizing)... However I have one problem where a figure I create in a function doesn't show up: # this is how I create a figure in a function Are you running ipython in pylab mode? See http://matplotlib.sourceforge.net/users/shell.html and http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] wx backup show figure (WAS: general matplotlib usage questions)
On Thu, Nov 20, 2008 at 1:29 PM, Robin [EMAIL PROTECTED] wrote: On Thu, Nov 20, 2008 at 5:22 PM, Christopher Barker try wxPython -- it's easy to install and works well. Thanks - it does seem nicer (doesn't have the mouse over resizing)... However I have one problem where a figure I create in a function doesn't show up: # this is how I create a figure in a function In [20]: def test_func(): : f = figure() : ax = f.add_subplot(111) : ax.plot([1,2,3,4],[1,2,3,4]) : f.show() : return f : One more thought -- if you are in pylab mode (so interactive is turned on) if you are making your draw calls through the api, as you are in this example, you will need to call draw after the plot commands, eg ax.plot(something) f.canvas.draw() This is explained in some detail in the shell page I pointed you to in my last post. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Embedding Basemap in a wx app
On Wed, Nov 19, 2008 at 2:31 PM, Mauro Cavalcanti [EMAIL PROTECTED] wrote: Greetings. Trying to develop a desktop application for interactive mapping using wxPython and Matplotlib, I have been doing some experiments with embedding maps generated by the Basemap module into a wxPython frame. You are almost there. You need to create your own axes instance self.ax = self.figure.add_subplot(111) and then pass this to your basemap map = Basemap(ax=self.ax) after you have issued all your basemap commands, manually force a draw self.figure.canvas.draw() and *do not* import pyplot or call pyplot.show() JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Installation problem
On Wed, Nov 19, 2008 at 3:56 AM, domenico09 [EMAIL PROTECTED] wrote: I got the same problem on my portable(windowx XP) but not on my desk top(windows XP) ! I reinstalled python, numpy and matplotlib either from internet and from my desk top (where things works well) but I got the same problem! thanks for any sugegstion Have you tried the enthought python distribution or python xy? Both are single click installers that come with python, numpy, ipython, matplotlib and more. http://www.enthought.com/products/epd.php http://www.pythonxy.com/foreword.php JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Scatter is slow to render many points
On Wed, Nov 19, 2008 at 8:56 AM, Gregory Desvignes [EMAIL PROTECTED] wrote: Hi all, I'm using matplotlib inside the backend_gtkagg with the scatter function to draw a simple graph with 2 to 4 points. The points may have only 2 differents sizes and 4 differents color depending on some criteria and should be 'clickable'. The problem is that the plot rendering is very slow when it deals with ~1 points, especially if we compare it with the rendering of the plot function using simple points (as the data_browser.py example) Does anybody knows if there is a way to make things going a little bit faster? plot with markers is *much* faster than scatter. If you have only a few different sizes and a few different colors, if you issue several plot commands with one or more marker symbols plot(x1, y1, 'o', ms=10, color='red') plot(x2 y2, 's', ms=20, color='green') plot(x3, y3, '+', ms=8, color='blue') It might be up to an order of magnitude faster. And the individual points will be selectable using the pick events, as described in http://matplotlib.sourceforge.net/users/event_handling.html Hope this helps, JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Embedding Basemap in a wx app
I'm CC-ing the list, because Jeff Whitaker is the basemap developer, and he will probably want to add it to the basemap examples. Thanks for the contribution. On Wed, Nov 19, 2008 at 4:31 PM, Mauro Cavalcanti [EMAIL PROTECTED] wrote: Dear John, It worked fine! Thank you very much for your help. I would like to donate the working example source code (attached) to the Matplotlib examples section, just in case it may be helpful to someone else. I intend to provide a more sophisticated exemple soon. With warmest regards, 2008/11/19 John Hunter [EMAIL PROTECTED]: On Wed, Nov 19, 2008 at 2:31 PM, Mauro Cavalcanti [EMAIL PROTECTED] wrote: Greetings. Trying to develop a desktop application for interactive mapping using wxPython and Matplotlib, I have been doing some experiments with embedding maps generated by the Basemap module into a wxPython frame. You are almost there. You need to create your own axes instance self.ax = self.figure.add_subplot(111) and then pass this to your basemap map = Basemap(ax=self.ax) after you have issued all your basemap commands, manually force a draw self.figure.canvas.draw() and *do not* import pyplot or call pyplot.show() JDH -- Dr. Mauro J. Cavalcanti Ecoinformatics Studio P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: [EMAIL PROTECTED] Web: http://studio.infobio.net Linux Registered User #473524 * Ubuntu User #22717 Life is complex. It consists of real and imaginary parts. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] API_CHANGES MIGRATION.txt
On Tue, Nov 18, 2008 at 3:41 AM, Benjamin Bardiaux [EMAIL PROTECTED] wrote: Dear matplotlib users, I'l looking for the files http://matplotlib.sf.net/API_CHANGES http://matplotlib.sourceforge.net/MIGRATION.txt that seem to have disappear from the new sf website. Thanks -- I've re-added these and put links to them in the need help sidebar at http://matplotlib.sf.net. You may need to refresh your browser to see the new links. We should include these in the rest docs proper, so they are exposed to the sphinx search tool, but I just went with the quick and easy for now. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Axis lines crossing in them middle of the plot
On Tue, Nov 18, 2008 at 4:25 AM, Mike Hansen [EMAIL PROTECTED] wrote: What would you recommend as the best way going about this? I'm willing to put some work in on this. There was someone back in July who posted some code moving in this direction, but it didn't feel like it was the right way to do things. He didn't get any response from the list. That was Tony's work, and it is a shame we didn't give him more feedback. It is definitely an important enhancement. Sometimes the things that are harder get marked with a star in my inbox, and the things that are easier get tackled right away, and the harder things get pushed down the queue. Which is why I encourage folks to make gentle reminders: the silence is usually not lack of interest, but lack of time. You should start by taking a look at where Tony left off. I will review his code too, and when we have both had a chance to digest it, we can discuss a plan of attack. http://www.nabble.com/Modifications-to-axis.py-to-allow-more-flexibility-in-positioning-axis-lines%2C-ticks%2C-etc.-td18573959.html#a18573959 Tony may be interested in contributing too. Reading over his email, one of the things that stumped him was trying to get this done right and maintain backwards compatibility. That is admirable, and we should try to achieve that where possible, but I don't think it is a requirement. This is a major feature enhancement, and is one of the things that have kept me from releasing mpl as 1.0, so if we need some breakage to get there we can live with it. Not too many people tweak the axis layout, in part because there is not much to tweak. Also, most use the Axes front end helper methods (eg ax.get_xticklabels()) which will insulate them from a reorg at the Axis layer. There are two related problems here: one easier, one harder. We can start with the easier one. The easy one is to have a detachable axis. Right now we have one on the right and one on the left for the x-axis. We may as well generalize this to allow folks to have as many as they want and put them whereever they want (center, offset farther to the left, etc.). It would be nice to support a different set of tick locators and formatters for each axis, eg you could have a left axis in dollars and a right axis in euros. Note this is not the same thing as having a different scale, in the sense of the two_scales example, this is just two different formatting of the same scale. The harder problem is supporting an arbitrary number of axis instances each with its own transform, etc. Eg generalizing the two_scales example. I suggest you punt on that one for now. If you really want to keep this easy, you can forget all about the locators and formatters and just focus on allowing the user to place the axis lines wherever they want, using the standard Axis locator and formatter for all the axis lines. That is probably the place to start -- we can always try to beef it up later. That part should be fairly easy. Another enhancement that would be nice would be to support a TextCollection for the tick labels. Drawing the tick labels is actually a pretty big bottleneck in the whole plot rendering time, and since the properties are naturally homogeneous (eg the rotation, the fontsize) we could probably save some time using a collection. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Save a plot background
On Tue, Nov 18, 2008 at 9:41 AM, Hrafnkell Pálsson [EMAIL PROTECTED] wrote: Ok, I tried your last suggestion and sure enough it worked. But it turns out to solve only half of my problem. I'd like to be able to restore the background (using the Agg backend) and then use it further, i.e. plot on it, without it disappearing. Elaborating on my real use case, what I want to do is to make a Basemap instance, plot the coastlines and other things that are constant in time (put marker on the maps for cities, watermark the figure, draw meridians and parallels and so on) and save that as a background. I would then restore this background and plot the weather (open and filled contours, quivers and barbs) onto it. I typically have data for some dozens of timesteps, so I'd be restoring the background many times. Each time I'd This should work fine as long as you make the figure frame and axes frame invisible. Basically, you need to create the figure background, and the axes background with all the grid lines, tick labels, coastlines, etc, save it, and then for the new figure make sure all the stuff you have saved is turned off. I am not a basemap user, but I know all this stuff is ultimately exposed. Eg for a plain vanilla axes, you would do fig1 = figure(frameon=False) ax1 = fig1.add_subplot(111) fig = figure(frameon=False) ax = fig.add_subplot(111, frameon=false, xticks=[], yticks=[]) fig.canvas.restore_region(background) This will turn off the rendering of both the background rectangle as well as all the ticks and their associated labels, ticklines and gridlines. Perhaps Jeff can advise you vis-a-vis the basemap api what the equivalent is - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Save a plot background
On Mon, Nov 17, 2008 at 8:05 AM, Hrafnkell Pálsson [EMAIL PROTECTED] wrote: Hi I tried you suggestions but it didn't work out for me. In the following code I try to save the axes and the grid from figure1 into buffer and then restore it on figure2 but figure2.png turns out to be of an empty canvas. #!/usr/bin/env /opt/python/bin/python # encoding: utf-8 import matplotlib if not matplotlib.get_backend()=='agg': matplotlib.use('Agg') import pylab figure1 = pylab.figure(1) axes1 = pylab.gca() axes1.grid() canvas1 = axes1.figure.canvas background = canvas1.copy_from_bbox(axes1.bbox) figure1.savefig('figure1.png') The only problem I could see with your code is that you need to force a draw before copying the background. But when I added the draw, and then further simplified to reuse the same canvas, I still am not seeing the restored region. I will need to do further digging to see what is going wrong, but the problem appears both on the maintenance branch and the trunk. Here is my modified test script: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt fig1 = plt.figure(1) ax1 = fig1.add_subplot(111) ax1.grid() fig1.canvas.draw() fig1.savefig('figure1.png') background = fig1.canvas.copy_from_bbox(ax1.bbox) fig1.clf() #figure2 = pylab.figure(2) #canvas2 = figure2.canvas fig1.canvas.restore_region(background) fig1.savefig('figure2.png') JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Save a plot background
On Mon, Nov 17, 2008 at 1:50 PM, Jae-Joon Lee [EMAIL PROTECTED] wrote: I think the savefig() command calls draw() internally, doesn't it? Ahh yes. The copy_from_bbox / restore_region was conceived as an aid to animation and I don't think I've used it in the context of savefig where none of the artists are involved in the restored region. Ie, in a typical animation use case, you draw the axes, background and ticks, store the region, and then animate a line on top of it. When you go to savefig, the axes background is redrawn because the associated artists already reside in the figure, along with the line in its final state. It should be fairly easy to expose the agg BufferRegion object in the artist API, so you could grab a buffer region from one canvas, bless it as an artist, and add it to the figure or another figure, with the x and y location attrs exposed so it could be easily moved. In this case you would get the zorder for free. This would help some, and would certainly address the case at hand, but the really big win would probably be something more like the chaco model, where each zorder is rendered onto a different rendering buffer, with a fairly straight-forward way to just re-render certain planes. This would certainly be harder. Could you elaborate a bit on your use case, which will help me in thinking about how this should be done? JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Save a plot background
On Mon, Nov 17, 2008 at 8:05 AM, Hrafnkell Pálsson [EMAIL PROTECTED] wrote: Hi I tried you suggestions but it didn't work out for me. In the following code I try to save the axes and the grid from figure1 into buffer and then restore it on figure2 but figure2.png turns out to be of an empty canvas. OK, ever since Jae-Joon clued me into to the importance of the savefig call, I realized there is a fairly easy solution for your problem. The problem you are having is that savefig is redrawing the figure frame which is essentially just filling the rectangular background of the figure canvas. This is obscuring the background you are trying to restore. SO just turn the frame off, and your background will be revealed in its place. Here is the example code: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt plt.close('all') # make sure we have all the same properties on all figs figprops = dict(figsize=(8,6), dpi=100, facecolor='white') fig1 = plt.figure(1, **figprops) ax1 = fig1.add_subplot(111) ax1.grid() fig1.canvas.draw() background = fig1.canvas.copy_from_bbox(fig1.bbox) fig1.savefig('figure1.png', dpi=100) # turn the frame off or it will overwrite the background fig2 = plt.figure(2, frameon=False, **figprops) fig2.canvas.restore_region(background) fig2.savefig('figure2.png', dpi=100) - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Save a plot background
On Sat, Nov 15, 2008 at 3:23 PM, Hrafnkell Pálsson [EMAIL PROTECTED] wrote: Hi I haven't managed to save a plot background into buffer to be able to restore it later. I use matplotlib to draw weather maps (see www.belgingur.is), and though the weather constantly changes the outlines of the countries are the same for every picture. Currently I plot the coastlines anew for every picture, which is kinda *not smart*. Have you tried the copy from bbox / restore_region methods. Draw just what you want to save, and use copy_from_bbox. Later when you want to plot something new, do a restore_region onto a clean canvas and then plot the new stuff on top: * background = canvas.copy_from_bbox(ax.bbox) - copy the region in ax.bbox into a pixel buffer and return it in an object type of your choosing. bbox is a matplotlib BBox instance from the transforms module. background is not used by the matplotlib frontend, but it stores it and passes it back to the backend in the restore_region method. You will probably want to store not only the pixel buffer but the rectangular region of the canvas from whence it came in the background object. * canvas.restore_region(background) - restore the region copied above to the canvas. * canvas.blit(bbox) - transfer the pixel buffer in region bounded by bbox to the canvas. Search the examples for copy_from_bbox on the web site http://matplotlib.sourceforge.net/search.html If you are still having troubles, let me know and I can give more help. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Twin axes share Formatters, but not ticks
On Sun, Nov 16, 2008 at 8:31 PM, Joshua J. Kugler [EMAIL PROTECTED] wrote: In opening: Thank you very much to Stan West and John Hunter for their help so far. OK, I've hit either a genuine bug in Matplotlib, or a serious gap in my understanding; probably the latter. If I missed something in the docs, please point me that way. Attached is a test case that shows what's going on, as well as the bad plots produced. I started with the two axis example. After setting the formatters for ax1, I set the xmajor ticks labels' font size to 40, and plot it, as well as ax2. That gives me a set of large X labels, and a set of small X labels. OK, I try setting ax2's major formatter to NullFormatter(), but that makes all the number disappear. As can be seen from the print statements, the instances of the formatters are the same for both ax1 and ax2, even though they are supposed to be different axis, BUT the instances of the tick labels are different, hence the disparity in font sizes. So, besides the work-around of setting font sizes on both sets of tick labels, what is the solution here? When you share an axis, the formatters and locators are shared as well. I'm not sure if this is idea, but this is the way it is. If you want to turn off the tick labels for ax2, the trick is to make them invisible, because the tick properties are not shared. So instead of using the NullLocator, do for label in ax2.get_xticklabels(): label.set_visible(False) Hope this helps, JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] More info: Re: Twin axes share Formatters, but not ticks
On Sun, Nov 16, 2008 at 8:38 PM, Joshua J. Kugler [EMAIL PROTECTED] wrote: I am leaning toward this being a true bug. If you take a look at attached plot (the code for which is where I first noticed this bug), you'll notice that the dates on the top graph (the one with two axis) look a little bold while the dates on the bottom graph look normal. The top set of dates are the one where I have to let font size (8) on two different sets of tick labels. w/o seeing the code that generated the figure it is hard to know, but the bold look probably arises from rendering the same tick labels twice in the same location, eg if you have a twinx, as it appears you do, but haven't made the ticks invisible (as per my earlier suggestion) on one of the axes. Perhaps we should make the ticks on the twin axes invisible by default. Also, when posting continuations related to a theme, eg your previous post on twin axes formatters, please try to keep them in the same thread by replying to yourself in the earlier thread. This makes it easier for people following the thread to see everything in one place, particularly those using threaded mail readers, as well as the future generations of googlers who will pick this conversation up on mail archive websites like nabble. Thanks, JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Set Ellipse Linestyle
On Sun, Nov 16, 2008 at 8:32 PM, B Clowers [EMAIL PROTECTED] wrote: I've been trying to set the linestyle of an ellipse with no success. I keep getting an attribute error whether I try setting the property via accessing the ellipse instance directly or through the artist. Any ideas? --if you uncomment the line containing the linestyle you should see the error--just paste into ipython -pylab. The example with the ls='dashed' uncommented works fine for me in svn head, and according to the CHANGELOG, support for linestyle was added in r5645 | jdh2358 | 2008-06-23 09:46:13 -0500 (Mon, 23 Jun 2008) | 1 line commited olle's linestyle patch patch This predates the 0.98.3 release, which was released at svn r5947. I'm not sure what version you are on, but linestyle should work on the latest mpl release. If you are having trouble with ls on 0.98.3, see if linestyle works since it's possible support for the alias was only added later. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] More info: Re: Twin axes share Formatters, but not ticks
On Sun, Nov 16, 2008 at 9:26 PM, Joshua J. Kugler [EMAIL PROTECTED] wrote: w/o seeing the code that generated the figure it is hard to know, but the bold look probably arises from rendering the same tick labels twice in the same location, eg if you have a twinx, as it appears you do, but haven't made the ticks invisible (as per my earlier suggestion) on one of the axes. Perhaps we should make the ticks on the twin axes invisible by default. Yup, that was it. Woohoo! Thanks! Great -- glad that worked. Perhaps we should fix the default behavior though... Weird, in my mailer (K-Mail) I replied to my message, and it threaded it properly when it came back. Maybe adding modifying the subject messed up some mailers? I think K-Kmail threads based on the references in the headers, e.g.: OK, my bad. It's looks like it is just gmail that is mucking it up (maybe other readers as well). nabble is ggeting it right: http://www.nabble.com/Twin-axes-share-Formatters%2C-but-not-ticks-to20532903.html No worries -- just wanted to make sure you were aware of the issue, and it appears you are more on top of it than me :-) JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib with native OSX port of GTK
On Mon, Nov 10, 2008 at 6:00 AM, Marcus Vinicius Eiffle Duarte [EMAIL PROTECTED] wrote: So, all the libraries and headers are installed in the default folders. However, when I try to build matplotlib I get the following error: In file included from src/backend_gdk.c:9: /usr/include/pygtk/pygtk.h:6:23: error: pygobject.h: No such file or directory /usr/include/pygtk/pygtk.h:8:21: error: gtk/gtk.h: No such file or directory In file included from src/backend_gdk.c:9: The error indicates the mpl build process is not finding your pygtk or gtk headers. Typically, you need to set your PKG_CONFIG_PATH to the directory where the *.pc config files are, and these will tell mpl how to include the headers and link to the libs. So you should also have pkg-config installed. There are some additional details here: http://ipython.scipy.org/moin/Py4Science/InstallationOSX -- scroll down to the matplotlib section. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Python 2.6
On Sat, Nov 8, 2008 at 10:39 PM, Jae-Joon Lee [EMAIL PROTECTED] wrote: John, I'm attaching an another patch, which seems to give a correct result for the figimage_demo. The flipud_out() calls before compositing seems to have no effect, so Ahh, I think you found the ultimate source of our woes and flupud complexity: the _image.from_images module was ignoring the stride, as you noted in the comment in your patch. I just fixed this n r6381, so the code behaves properly at the extension code level and we don't have to do all those confusing flips in the axes or figure compositing methods. So the code is now simpler, and it works. Thanks for digging into this. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Python 2.6
On Fri, Nov 7, 2008 at 7:24 AM, Michael Droettboom [EMAIL PROTECTED] wrote: John Hunter wrote: What say you other developers -- any major holdups? I think this bug is reasonably serious, if anyone wants to take a look at it. It affects PDF, PS, SVG as well as the Gtk and GtkCairo mentioned in the report. I've taken a kick at it a couple of times, but haven't found the magic incantation. I suspect it's a one-liner fix, just don't know which one... ;) https://sourceforge.net/tracker/index.php?func=detailaid=2160909group_id=80706atid=560720 I spent some time trying to fix this yesterday, and I too was confounded by all the flipud_out calls in the various parts of the code. I was not able to figure ot why agg was working and svg not, since they appear to be making similar calls, and eventually had to give up to work on some other stuff. I'll try and find some time this weekend to plan another attack, and hopefully simplify and document the code a bit if I am successful. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Where else to look when tick_label.set_fontsize isn't working
On Sat, Nov 8, 2008 at 1:02 AM, Joshua J. Kugler [EMAIL PROTECTED] wrote: On Friday 07 November 2008, John Hunter said something like: http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem Sorry, I wasn't so much reporting a problem with matplotlib as I was wondering if I was missing something. I'll try to extract a free-standing example, but it might be hard...there's a lot of code interacting here. I'll work on that when I get a chance. Thanks! The point about making a free standing example is that often there is some other problem with your code, and the problem is not in the part you are posting or asking about. And we can't help with the part we can't see. In stripping your example down to a free standing example, often you will find the problem goes away. Then you will ask: what is different about from free the standing example and my real code, and in doing so find the real problem. This is not always the case, but it happens enough that it is a worthwhile exercise. That is why a properly crafted mailing list post is so useful -- the acting of positing properly often fixes the bug you are trying to report even before you hit the send button. It has happened for me countless times. In the heat of trying to find a solution to the problem, it is hard to justify the extra time to boil the problem down to isolated, free-standing code, but in my experience nothing is as effective as taking that extra step. By not doing the extra work to make a simple example that we can run, you are asking us to do so. Its really not that hard -- just grab one of the date demos at http://matplotlib.sourceforge.net/examples/index.html and set the fonts as you are doing in your code and see if the problem persists. If it does, post it an we will fix it. If not, you have to figure out where the problem really resides. I'm not trying to be snippy, it's just that the matplotlib mailing list gets a lot of traffic, and in addition to trying to help you with your problems, we are trying to fix bugs, add new features, solve platform issues and distribution issues, put out releases, and we all have jobs and families. I think you get the idea. We need you to do the maximum amount of work possible so we can efficiently help you. When we get a free-standing example that shows a real problem, the odds of you getting help and patch rise dramatically. Thanks, and good luck, JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Python 2.6
On Thu, Nov 6, 2008 at 4:28 PM, Darren Dale [EMAIL PROTECTED] wrote: Stan West checked out my subprocess patch on windows with python-2.5, which should take care of a bunch of deprecation warnings. I need to double check that I got them all, maybe I can get to it this weekend. I'm in favor of dropping support for python-2.4, but on the other hand I think the most recent version of RHEL still uses this version. Actually, we still use 2.4 at work, so I'd like to continue supporting 2.4 for a while I guess, for purely selfish reasons. But perhaps we should stop making binaries for it to ease the burden on Charlie. Once the 2.6 binaries for numpy are out and we are making binaries for the next release, that is JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Several Functions, One plot (My Hello World)
On Sat, Nov 8, 2008 at 8:23 AM, Alan G Isaac [EMAIL PROTECTED] wrote: On 11/7/2008 10:36 PM [EMAIL PROTECTED] apparently wrote: I'm new to the list and also to matplotlib. I'm writing a small program to draw oil well diagrams in a simple way in 2D. I guess Mike is a bit nonplussed by the attention this example receives, but I find it useful: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg07706.html And all the examples now have their own screenshots page, eg http://matplotlib.sourceforge.net/examples/pylab_examples/dolphin.html though the entire thread is worth an occasional reread :-) http://www.nabble.com/ploting-a-contour-graph-from-data-files-td18491504.html#a18491504 JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Python 2.6
On Sat, Nov 8, 2008 at 6:10 PM, Jae-Joon Lee [EMAIL PROTECTED] wrote: My original patch does not work for this case, because the figimage is drawn by Figure.draw() not by Axes.draw() method. I'm attaching a new patch where I applied the same correction to the Figure.draw(). I tested GtkAgg, Gtk, GtkCairo, Pdf, Ps and they all worked fine. So I managed to sneak some time to apply and test these after all -- but I am getting in a little trouble with my wife :-) The layer images demo looks great for pdf, svg and png, but I am still seeing problems with the figimage_demo for origin upper. On svg and pdf in my tests, blue still appears down, though is correctly up on png. I went ahead and committed your changes (with a minor variation that the list comprehensions are expressed as plain-ol-loops because some people consider the use of a list comprehension simply to do in place modifications where the list itself is discarded to be an abuse of the construct) to revision 6380. Make sure I didn't screw something up, but the figimage_demo still looks broken to me for the case currently in fsvn Thanks for all the progress! JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Python 2.6
On Sat, Nov 8, 2008 at 5:45 PM, Jae-Joon Lee [EMAIL PROTECTED] wrote: I think the problem is caused by the image compositing logic in the Axes.draw() method. It currently makes a composite image first and then flip the resulting image if necessary. But I think what should happen is to flip the original images first and then do the compositing. So, test the attached patch and see if it solves the problem. Hey Jae Joon -- thanks for looking into this. I don't have time to test this patch, but I wanted to mention that there is an analogous problem for figure image compositing -- see figimage_demo.py. agg shows the correct behavior: the two images should be in the lower left, and the blue should be down for image origin=lower and the blue should be up for image origin=upper. So if you are having success with the image compositing orientation problems on the various backends, you may want to see if your fixes apply to the figimage problems as well. Thanks, JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Where else to look when tick_label.set_fontsize isn't working
On Fri, Nov 7, 2008 at 7:51 PM, Joshua J. Kugler [EMAIL PROTECTED] wrote: With the help of John Hunter and Stan West, I got some of my tick labels sizing correctly. I have this chunk of code: for label in self.main_axes.get_xticklabels(): label.set_fontsize(self.xtick_labelsize) main_ticks = self.main_axes.get_yticklabels() sub_ticks = (self.sub_axes.get_yticklabels() if hasattr(self.sub_axes, 'get_yticklabels') else []) for label in main_ticks + sub_ticks: label.set_fontsize(self.ytick_labelsize) Please post a complete, free-standing example, that we can run, that illustrates the problem. http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Combine jpegs
On Thu, Nov 6, 2008 at 9:00 AM, Nils Wagner [EMAIL PROTECTED] wrote: Hi all, Is it possible to combine jpegs with matplotlib or PIL ? Any pointer would be appreciated. if you have PIL installed, you can load them into mpl with imread, and then set the alpha channel to make one partially transparent, and then overlay them as in the layer images example http://matplotlib.sourceforge.net/examples/pylab_examples/layer_images.html Below is some example code that loads a jog into RGB data, and then embeds it in RGBA with an alpha mask of 0.5. Note however, that mpl is not a general image processing library, so you will probably have better luck with PIL. I'm no PIL expert, so can't help there... In [8]: from matplotlib.image import imread In [9]: im = imread('lena.jpg') In [10]: im.shape Out[10]: (512, 512, 3) In [12]: import numpy as np In [13]: rgba = np.zeros((512,512,4)) In [14]: im.dtype Out[14]: dtype('uint8') In [15]: im = im.astype(float)/255. In [17]: rgba[:,:,:3] = im In [18]: rgba[:,:,-1] = 0.5 - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Python 2.6
On Thu, Nov 6, 2008 at 11:28 AM, KURT PETERS [EMAIL PROTECTED] wrote: I recently tried to install for python 2.6 and got an error that the dll is incompatible. Is there a version for 2.6? I didn't see one here: No, we haven't released any binaries for 2.6. It is probably getting to be time to release a new version of mpl, especially since 2.6 has been out for a while and lots of new fixes have gone into mpl since our last major release. Charlie, what is your availability? We would need to wait until at least next week so we could do a feature freeze and a last round of fixes. What say you other developers -- any major holdups? And should we stop doing binary builds for python 2.4 according to our unofficial policy of supporting the most recent two python releases? JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] twin / dual / two axis seems to confuse or break toolbar magnifier
On Tue, Nov 4, 2008 at 7:29 AM, Michael Droettboom [EMAIL PROTECTED] wrote: Can you be more specific about what is going wrong? The zoom magnifier seems to work fine for me with or without twinx, but perhaps we just have different expectations of how it works. Could you perhaps provide screenshots? Note that only one of the two axes can get the events, and that is determined by the axes zorder. So if you want ax1 to get the events ax1 = fig.add_subplot(111) ax1t = ax1.twinx() ax1.set_zorder(10) ax1t.set_zorder(1) JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Testing - my posts aren't showing up on the list
On Tue, Nov 4, 2008 at 2:48 PM, Joshua J. Kugler [EMAIL PROTECTED] wrote: I've sent two messages to this list, and neither have appeared in the archives, or come back to me. Did I use the right combination of words to get stopped by a spam filter? :) I have not seen any messages from you in the moderator queue, which is where the spam shows up. Not sure what the problem is, but this one got through :-) - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting tick labelsize programatically
On Tue, Nov 4, 2008 at 3:13 PM, Joshua J. Kugler [EMAIL PROTECTED] wrote: [Trying one more time.] I've read docs, search the list archive, and tried to step through code. The docs you are looking for are http://matplotlib.sourceforge.net/users/artists.html. How can I set things like xtick.labelsize and ytick.labelsize via the object oriented interface? I have a graph object, and I can't find anywhere in the data structure for the completed graph where the tick label sizes are stored, nor can I find functions to set them. Here is one way to do it:: for label in ax.get_xticklabels() + ax.get_yticklabels(): label.set_fontsize(12) But the artist tutorial above will give you a more in-depth explanation of the various containers and methods. JDH - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users