Re: [Matplotlib-users] Can I make a mplot3d PolyCollection Plot with projection on back wall
This example shows how to use 2d plots in a 3d plot: http://matplotlib.sourceforge.net/examples/mplot3d/2dcollections3d_demo.html These examples may also help: http://matplotlib.sourceforge.net/trunk-docs/examples/mplot3d/contour3d_demo3.html http://matplotlib.sourceforge.net/trunk-docs/examples/mplot3d/pathpatch3d_demo.html -Ben -Original Message- From: Jeremy Conlin [mailto:jlcon...@gmail.com] Sent: Wednesday, April 14, 2010 11:14 AM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Can I make a mplot3d PolyCollection Plot with projection on back wall I want to make a plot similar to this demo: http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html but also make simple line plots on the back wall of the plot, perhaps with the pyplot.plot command. How can I do this? Thanks, Jeremy -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Polar 3D plot?
I don't see a reason why this can't be implemented. It is probably pretty simple to change the surface plot code to use a polar grid instead of a rectangular grid. Of course this won't change the look of the rectangular axes, but maybe that is not a problem. I invite you to take a shot at implementing this. You will find the mplot3d code pretty straightforward. (And a lot smaller than you might expect). -Ben -Original Message- From: klukas [mailto:klu...@wisc.edu] Sent: Wednesday, March 17, 2010 4:34 PM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Polar 3D plot? I'm guessing this is currently impossible with the current mplot3d functionality, but I was wondering if there was any way I could generate a 3d graph with r, phi, z coordinates rather than x, y, z? The point is that I want to make a figure that looks like the following: http://upload.wikimedia.org/wikipedia/commons/7/7b/Mexican_hat_potential_polar.svg Using the x, y, z system, I end up with something that has long tails like this: http://upload.wikimedia.org/wikipedia/commons/4/44/Mecanismo_de_Higgs_PH.png If I try to artificially cut off the data beyond some radius, I end up with jagged edges that are not at all visually appealing. I would appreciate any crazy ideas you can come up with. Thanks, Jeff P.S. Code to produce the ugly jaggedness is included below: --- from mpl_toolkits.mplot3d import Axes3D import matplotlib import numpy as np from matplotlib import cm from matplotlib import pyplot as plt step = 0.04 maxval = 1.0 fig = plt.figure() ax = Axes3D(fig) X = np.arange(-maxval, maxval, step) Y = np.arange(-maxval, maxval, step) X, Y = np.meshgrid(X, Y) R = np.sqrt(X**2 + Y**2) Z = ((R**2 - 1)**2) * (R 1.25) ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) ax.set_zlim3d(0, 1) #plt.setp(ax.get_xticklabels(), visible=False) ax.set_xlabel(r'$\phi_\mathrm{real}$') ax.set_ylabel(r'$\phi_\mathrm{im}$') ax.set_zlabel(r'$V(\phi)$') ax.set_xticks([]) plt.show() -- View this message in context: http://old.nabble.com/Polar-3D-plot--tp27937798p27937798.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to 'rotate' a 3D plot?
There is an uncommented, and therefore undocumented function: axes3d.view_init(elev, azim) that you can use to rotate the axes. If you have not already, I suggest you use the current SVN version of MPL instead of the 0.99.1 version. Mplot3d has some more features in the trunk, but it is still rough around the edges. -Ben -Original Message- From: Alexander Dietz [mailto:alexanderdie...@googlemail.com] Sent: Tuesday, March 16, 2010 1:25 PM To: Matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] How to 'rotate' a 3D plot? Hi, I have successfully created a 3D scatter plot with mplot3d, but how can I rotate the plot around e.g. the z-axis? I do not want to use the user interface but I would like to use a command to do that. But I could not find good documentation anywhere and the commands attributed to the Axes3D also do not show anything obvious. Thanks Alex -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Older Version of Matplotlib for Python 2.2.1
what kind of errors did you get when building on windows? I recently found out that Visual Studio is required to build MPL on windows. This is because MPL contains C++ sources. Additionally, you must have the same version of Visual Studio that was used to build Python. So if you installed python 2.2.1 from a windows installer, then you will have to find out which version of Visual Studio to use. But I think if you build python yourself, then you can use whatever version of Visual Studio you want. This is the error you get when you have the wrong version of Visual Studio. At least in Python 2.6. The error message may be different in older versions of python. error: Unable to find vcvarsall.bat -Ben From: Schnappauf, Andreas [mailto:andreas.schnapp...@isyst.de] Sent: Thursday, March 04, 2010 9:04 AM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Older Version of Matplotlib for Python 2.2.1 Hi there, I was searching for an older version of matplotlib for using it with python 2.2.1 (parts of the project can only be interpreted with this old version :(). Is there a package for an installation under windows (just like the current versions)? I tried to build 0.80 and 0.87 from the sources and had no success. Thx for any help! Greetings Andreas iSyst Intelligente Systeme GmbH Nordostpark 91 | 90411 Nuernberg Geschaeftsfuehrer: Prof. Dr.-Ing. Hans Rauch, Christine Rauch, Daniel Heinrich Sitz der Gesellschaft: Nuernberg Registergericht: Amtsgericht Nuernberg HRB 17887 Steuernr. 241/129/40894 | USt-IdNr.: DE212895677 -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Axes3D and basemap
Here is a partial solution. If you use the SVN code, check out this example: http://matplotlib.sourceforge.net/trunk-docs/examples/mplot3d/pathpatch3d_demo.html I haven't ever done it, but I think you can create some kind of image patch. -Ben -Original Message- From: John [H2O] [mailto:washa...@gmail.com] Sent: Tuesday, March 02, 2010 1:10 PM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Axes3D and basemap Has anyone ever used a basemap instance as the 'floor' of an Axes3D plot? What I'm looking for is example code to do something like this: http://www.dfanning.com/tips/scatter3d_on_map.jpg Thanks, john -- View this message in context: http://old.nabble.com/Axes3D-and-basemap-tp27759152p27759152.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mplot3d stays?
Interesting, but I think subdividing triangles like this is unnecessary. For most cases, when one triangle completely covers the other, all that is required it to Z order the triangles. This is what mplot3d does already. The only case we have yet to handle is when one triangle pierces the other. As seen in the attached image. Triangle B is mostly behind triangle A, except for a small piece labeled C. All we would have to do is determine the line of intersection, then create a new triangle C. Then we just draw B first, then A, then C. I think the hardest part is probably doing this for general polygons and handling the edges properly. But that should not be super hard. -Ben From: Friedrich Romstedt [friedrichromst...@gmail.com] Sent: Saturday, February 27, 2010 11:28 AM To: matplotlib-users Subject: Re: [Matplotlib-users] mplot3d stays? http://www.friedrichromstedt.org/python/pyclip/a01.Zerteilung.pdf (It's unfortunately in german, but the graphics are self-explaining) A school mate working together with me on the project has worked that out. H = number of corners of the front triangle lying inside of the back triangle V = number of corners of the back triangle lying inside of the front triangle S = number of the collinear edges of the two triangles Z = number of intersection points of the two tringles' edges, minus the number of those occuring because of collinear edges. Red: front triangle Black: back triangle Green: subdivision lines in the back triangle. I will check my implementation in C++ today. I will maybe need some advice in making a Python module out of it. Friedrich -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users attachment: triangles.png-- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mplot3d stays?
I also agree with Reinier. I want my 3d plots to look as close as possible to my 2d plots. Because mplot3d uses so much of the same matplotlib core, this is trivial. As Friedrich mentioned, the mplot3d code is actually pretty small. To me, that is a great feature. I found the mplot3d code very accessible. I do agree that there is still much work to be done in mplot3d. But I think starting from scratch is a waste of time. FYI, I looked into using mayavi2 before settling on mplot3d. Mayavi can create some stunning graphics, but I found that it is very restrictive in its plotting options. Take for example the 3d scatter plot. They combined the size and color parameter. Getting around this strange restriction took me quite some time. (Installation for me was also a pain due to VTK). -Ben -Original Message- From: Jakub Nowacki [mailto:j.s.nowa...@googlemail.com] Sent: Friday, February 26, 2010 12:01 PM To: matplotlib-users Subject: Re: [Matplotlib-users] mplot3d stays? Dear all, I don't know if creating full blown 3d library makes much sense. I think Reinier is right here that the current mplot3d creates quite satisfactory outcome with matplotlib look-and-feel we all like. In general, there are 3d libraries/packages out there (VTK, Mayavi2 etc.), which do most of the stuff one would need. The problem is many times using is not that trivial. Also, the installation process is usually much more complex, eg. setting up mayavi2 on snow leopard took me several days. I asked the question in the first place because in many cases I need rather simple 3d plotting tool, without al the massive rendering capabilities etc. Since I use matplotlib anyway, it would be nice to use the same tool and not be forced to install and learn something new just to plot not very complicated surface. Hence, I think the main goal here should be to have a relatively simple but usable plotting tool with matplotlib look-an-feel. BTW I didn't know that my simple question would generate such a discussion. :) Best wishes, Jakub -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error build from SVN on Windows XP
I am getting the same error. Here is my console output: C:\Projects\matplotlibpython setup.py build basedirlist is: ['win32_static'] BUILDING MATPLOTLIB matplotlib: 1.0.svn python: 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] platform: win32 Windows version: (5, 1, 2600, 2, 'Service Pack 3') REQUIRED DEPENDENCIES numpy: 1.4.0 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '.', '.\freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of '.' Tkinter: no * Tkinter present, but header files are not found. * You may need to install development packages. wxPython: 2.8.10.1 * WxAgg extension not required for wxPython = 2.8 Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to import gtk in your build/install environment Mac OS X native: no Qt: no Qt4: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: 2008c OPTIONAL USETEX DEPENDENCIES dvipng: file. ghostscript: 'gswin32c' is not recognized as an internal or external command, operable program or batch file. latex: no [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil/zoneinfo'] running build running build_py copying lib\matplotlib\mpl-data\matplotlibrc - build\lib.win32-2.6\matplotlib\mpl-data copying lib\matplotlib\mpl-data\matplotlib.conf - build\lib.win32-2.6\matplotlib\mpl-data running build_ext building 'matplotlib.ft2font' extension error: Unable to find vcvarsall.bat I found that I do have a vcvarsall.bat file. it is located here: C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat I thought this might be a bug in freetype2, so i downloaded the latest windows version from: http://gnuwin32.sourceforge.net/packages/freetype.htm with no luck. setup.py still says it can't verify my freetype2 version. After grepping through lots of code, I found that vcvarsall.bat is only listed in these files: C:\Python26\Lib\distutils\msvc9compiler.py C:\Python26\Lib\distutils\tests\test_msvc9compiler.py C:\Python26\Lib\site-packages\numpy\distutils\command\config.py C:\Python26\Lib\site-packages\numpy\distutils\fcompiler\compaq.py And after looking at some code comments, I think this is either a bug in python 2.6.4, or python 2.6 requires Visual Studio 2008. I only have Visual Studio 2005 installed. Any thoughts? Thanks, -Ben PHobson wrote: Whenever I try to build from source, I get an error saying that it can't find vcvarsall.bat. Here are the last few lines of the output from DOS: copying lib\pytz\zoneinfo\US\Pacific - build\lib.win32-2.6\pytz\zoneinfo\US copying lib\pytz\zoneinfo\US\Pacific-New - build\lib.win32-2.6\pytz\zoneinfo\US copying lib\pytz\zoneinfo\US\Samoa - build\lib.win32-2.6\pytz\zoneinfo\US copying lib\dateutil\zoneinfo\zoneinfo-2008e.tar.gz - build\lib.win32-2.6\dateutil\zoneinfo running build_ext building 'matplotlib.ft2font' extension error: Unable to find vcvarsall.bat Now I can't import pyplot. Any thoughts? Thanks, Paul M. Hobson Senior Staff Engineer -- Geosyntec Consultants 55 SW Yamhill St, Ste 200 Portland, OR 97204 Phone: 503.222.9518 www.geosyntec.com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/Error-build-from-SVN-on-Windows-XP-tp27251915p27714548.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval
[Matplotlib-users] boxplot bug
I found an inconsistency with how boxplots are rendered between version 0.99.1 and the svn head. See attached images. I have never seen a boxplot cross back on itself like this before. Is this the expected behavior? Thanks, -Ben Ben Axelrod Robotics Engineer (800) 641-2676 x737 [cid:031242817@23022010-0FCD] www.coroware.comhttp://www.coroware.com/ www.corobot.nethttp://www.corobot.net/ inline: image002.gifattachment: boxbug-svnhead.pngattachment: boxbug-0991.png boxbug.py Description: boxbug.py -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] missing module docs
I noticed that there are many modules in the current code base that are not listed at: http://matplotlib.sourceforge.net/modindex.html. I understand that a few are new files and that the documentation for these will be generated during the next release. But I know that most of these were in the last release so should have had their documentation generated. Am I missing something? Can the documentation for these modules be found somewhere else? bezier blocking_input contour docstring finance hatch image mlab mpl offsetbox patheffects pylab pyparsing quiver rcsetup table texmanager textpath tight_bbox units widgets windowing Thanks, -Ben Ben Axelrod Robotics Engineer (800) 641-2676 x737 [cid:281553619@22022010-0FB8] www.coroware.comhttp://www.coroware.com/ www.corobot.nethttp://www.corobot.net/ inline: image002.gif-- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] fontfamily broken
The online documentation indicates that either family, fontfamily, fontname, or name can be used in all the standard text methods. However, I have found that the implementation for fontfamily seems to be missing. This is the traceback I get when I try to use it: Traceback (most recent call last): File test0.py, line 10, in module ax.set_title(Title, fontfamily='serif') File C:\Python26\lib\site-packages\matplotlib\axes.py, line 2735, in set_title self.title.update(kwargs) File C:\Python26\lib\site-packages\matplotlib\artist.py, line 621, in update raise AttributeError('Unknown property %s'%k) AttributeError: Unknown property fontfamily And here is some simple code that triggers the bug and exercises the text API: import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ax.scatter([1,2,3],[3,1,2]) ax.set_title(Title, family='serif') ax.set_title(Title, fontfamily='serif') ax.set_title(Title, fontname='serif') ax.set_title(Title, name='serif') ax.set_title(Title, size='large') ax.set_title(Title, fontsize='large') ax.set_title(Title, style='italic') ax.set_title(Title, fontstyle='italic') ax.set_title(Title, weight='bold') ax.set_title(Title, fontweight='bold') ax.set_xlabel(x label, family='serif') ax.set_xlabel(x label, fontfamily='serif') ax.set_xlabel(x label, fontname='serif') ax.set_xlabel(x label, name='serif') ax.set_xlabel(x label, size='large') ax.set_xlabel(x label, fontsize='large') ax.set_xlabel(x label, style='italic') ax.set_xlabel(x label, fontstyle='italic') ax.set_xlabel(x label, weight='bold') ax.set_xlabel(x label, fontweight='bold') ax.text(1,1,Foo, family='serif') ax.text(1,1,Foo, fontfamily='serif') ax.text(1,1,Foo, fontname='serif') ax.text(1,1,Foo, name='serif') ax.text(1,1,Foo, size='large') ax.text(1,1,Foo, fontsize='large') ax.text(1,1,Foo, style='italic') ax.text(1,1,Foo, fontstyle='italic') ax.text(1,1,Foo, weight='bold') ax.text(1,1,Foo, fontweight='bold') plt.show() Thanks, -Ben Ben Axelrod Robotics Engineer (800) 641-2676 x737 [cid:531214515@18022010-1186] www.coroware.comhttp://www.coroware.com/ www.corobot.nethttp://www.corobot.net/ inline: image002.gif-- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] PyCon
Is anyone planning on attending PyCon in Atlanta next week? http://us.pycon.org/2010/about/ -Ben Ben Axelrod Robotics Engineer (800) 641-2676 x737 [cid:484541315@12022010-129E] www.coroware.comhttp://www.coroware.com/ www.corobot.nethttp://www.corobot.net/ inline: image002.gif-- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Sankey diagram
Really cool plot. Speaking of the 1.0 release, is there a target date set? And if there is going to be another bug-fix release before 1.0, is there a target date for that? Thanks, -Ben -Original Message- From: John Hunter [mailto:jdh2...@gmail.com] Sent: Wednesday, February 10, 2010 10:55 AM To: Yannick Copin Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Sankey diagram 2010/2/9 Yannick Copin yannick.co...@laposte.net: Hi List, I made a script to draw very simple (single-direction single-input single-sided single-everything) Sankey diagrams (attached). I think I could share, if it can be of any use... Great -- I had never heard of a Sankey diagram but just took a look on wikipedia. Very nice -- I contributed this to examples/api and it will show up on the web site and gallery after the mpl 1.0 release. Thanks for sending it! JDH -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Figure.draw_artist() bug with Text
I see. But why would I need to set the figure manually when I am drawing with a figure? Is it ever the case where you set one figure, but draw with another? For example: textartist.set_figure(fig1) fig2.draw_artist(textartist) Also, other atists don't fail in this manner if I don't use artist.set_figure(). -Ben -Original Message- From: Jae-Joon Lee [mailto:lee.j.j...@gmail.com] Sent: Monday, February 08, 2010 6:36 PM To: Ben Axelrod Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Figure.draw_artist() bug with Text This is not a bug. The exception is raised simply because textartist.figure is None (and it is None because you never set it). textartist you created is not properly set up (no figure, no axes, no transform). You may do textartist = Text(0.5, 0.5, Foo) textartist.set_figure(fig) fig.draw_artist(textartist) fig.canvas.blit(fig.bbox) But, this is not the recommended way of doing things. draw_artist is mainly for doing animation. http://matplotlib.sourceforge.net/examples/animation/index.html Regards, -JJ On Mon, Feb 8, 2010 at 4:24 PM, Ben Axelrod baxel...@coroware.com wrote: I am getting a fault when I try to use Figure.draw_artist() with a matplotlib.text.Text object. Since matplotlib.text.Text inherits from matplotlib.artist.Artist, which is what draw_artist() takes, this should probably work. Tested with latest SVN code on Linux. Here is the traceback: Traceback (most recent call last): File test.py, line 10, in module fig.draw_artist(textartist) File /usr/local/lib/python2.6/site-packages/matplotlib/figure.py, line 816, in draw_artist a.draw(self._cachedRenderer) File /usr/local/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /usr/local/lib/python2.6/site-packages/matplotlib/text.py, line 549, in draw bbox, info = self._get_layout(renderer) File /usr/local/lib/python2.6/site-packages/matplotlib/text.py, line 267, in _get_layout key = self.get_prop_tup() File /usr/local/lib/python2.6/site-packages/matplotlib/text.py, line 716, in get_prop_tup self.figure.dpi, id(self._renderer), AttributeError: 'NoneType' object has no attribute 'dpi' And here is some simple code to trigger the bug: #!/usr/bin/env python # display bug in figure.draw_artist(matplotlib.text) import matplotlib.pyplot as plt from matplotlib.text import Text fig = plt.figure() plt.draw() textartist = Text(0.5, 0.5, Foo) fig.draw_artist(textartist) plt.show() #end code Note that I still get the bug even when i specify figsize and dpi on the figure like so: fig = plt.figure(figsize=(2,2), dpi=300) -Ben -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Verifying the Use of show()? Win XP
Maybe instead of plot.show() you should do something like: plot.draw() raw_input('Press ENTER to exit') Personally, I also use IDLE on Windows XP to edit my matplotlib files. However, I never execute in IDLE. I simply double click the file in windows explorer. -Ben -Original Message- From: Wayne Watson [mailto:sierra_mtnv...@sbcglobal.net] Sent: Tuesday, February 09, 2010 11:07 AM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Verifying the Use of show()? Win XP I'm sure not making much progress on understanding show(). When used in XP in IDLE or by file execution (click on file name), it seems to tie up the executing program. In IDLE, the shell window stops and one must exit the window. I'd appreciate it if someone could take any examples from http://matplotlib.sourceforge.net/index.html and try to execute them as in the first paragraph to see if they terminate successfully.Let me know what OS used, hopefully XP, and if you used IDLE or file execution. I suspect you will find every example there ends with show(). Try putting a print statement after show() you've done it with the show() the last line. -- Crime is way down. War is declining. And that's far from the good news. -- Steven Pinker (and other sources) Why is this true, but yet the media says otherwise? The media knows very well how to manipulate us (see limbic, emotion, $$). -- WTW -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Axes3D rotation not working when embedded in backend
One more note about Axes3D and mouse rotation. Axes3D disconnects the mouse callbacks when cla() is called. Which means that if you do this: self.axes = Axes3D(self.figure) self.axes.scatter(xs, ys, zs) self.axes.cla() self.axes.scatter(xs, ys, zs) then the plot will have no mouse rotation. To fix this, mouse_init() should be called after cla(). Currently, all of this is undocumented. Is disconnecting mouse callbacks on cla() the preferred matplotlib way to do things? Is it safe to *not* disconnect mouse callbacks on cla()? Maybe there is another type of destructor that is more appropriate for this? Thanks, -Ben -Original Message- From: Ben Axelrod [mailto:baxel...@coroware.com] Sent: Saturday, February 06, 2010 5:55 PM To: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Axes3D rotation not working when embedded in backend I looked into this issue a little bit and found that the FigureCanvas must be set on the Figure before the 3D axes is instantiated. A simple re-ordering of the lines in the code below makes mouse rotation work again. # ... self.figure = Figure() self.canvas = FigureCanvas(self, -1, self.figure) #You must set up the canvas before creating the 3D axes self.axes = Axes3D(self.figure) # ... Perhaps this should be documented somehow? Or maybe a new mplot3d example code should be added. Or maybe Axes3D.mouse_init() should warn the user if self.figure.canvas is None. -Ben -Original Message- From: Ben Axelrod [mailto:baxel...@coroware.com] Sent: Monday, February 01, 2010 3:56 PM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Axes3D rotation not working when embedded in backend I would like to use Axes3D embedded in Wx. This works, but there is no mouse rotation. Clicking and dragging the mouse on the plot does not rotate the 3D axes like it does in the scatter3d_demo.py. I tried: WX, WXAgg, and TkAgg with similar results. Can this be fixed soon, or can someone point me to where I can try to fix it? I tested with the latest SVN tree on Linux and Windows. Thanks, -Ben Below is some sample code adapted from embedding_in_wx2.py, but with an Axes3D instead of the regular plot: #!/usr/bin/env python # adapted from example code embedding_in_wx2.py # Used to guarantee to use at least Wx2.8 import wxversion wxversion.ensureMinimal('2.8') import numpy as np import matplotlib # uncomment the following to use wx rather than wxagg #matplotlib.use('WX') #from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas # comment out the following to use wx rather than wxagg matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure from mpl_toolkits.mplot3d import Axes3D import wx class CanvasFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) self.SetBackgroundColour(wx.NamedColor(WHITE)) self.figure = Figure() self.axes = Axes3D(self.figure) xs = np.random.rand(100) ys = np.random.rand(100) zs = np.random.rand(100) self.axes.scatter(xs, ys, zs) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() self.add_toolbar() # comment this out for no toolbar def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top self.SetToolBar(self.toolbar) else: # On Windows platform, default window size is incorrect, so set # toolbar width to figure width. tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. self.toolbar.SetSize(wx.Size(fw, th)) self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() def OnPaint(self, event): self.canvas.draw() class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' frame = CanvasFrame() frame.Show(True) return True app = App(0) app.MainLoop() #end code
[Matplotlib-users] Figure.draw_artist() bug with Text
I am getting a fault when I try to use Figure.draw_artist() with a matplotlib.text.Text object. Since matplotlib.text.Text inherits from matplotlib.artist.Artist, which is what draw_artist() takes, this should probably work. Tested with latest SVN code on Linux. Here is the traceback: Traceback (most recent call last): File test.py, line 10, in module fig.draw_artist(textartist) File /usr/local/lib/python2.6/site-packages/matplotlib/figure.py, line 816, in draw_artist a.draw(self._cachedRenderer) File /usr/local/lib/python2.6/site-packages/matplotlib/artist.py, line 55, in draw_wrapper draw(artist, renderer, *kl) File /usr/local/lib/python2.6/site-packages/matplotlib/text.py, line 549, in draw bbox, info = self._get_layout(renderer) File /usr/local/lib/python2.6/site-packages/matplotlib/text.py, line 267, in _get_layout key = self.get_prop_tup() File /usr/local/lib/python2.6/site-packages/matplotlib/text.py, line 716, in get_prop_tup self.figure.dpi, id(self._renderer), AttributeError: 'NoneType' object has no attribute 'dpi' And here is some simple code to trigger the bug: #!/usr/bin/env python # display bug in figure.draw_artist(matplotlib.text) import matplotlib.pyplot as plt from matplotlib.text import Text fig = plt.figure() plt.draw() textartist = Text(0.5, 0.5, Foo) fig.draw_artist(textartist) plt.show() #end code Note that I still get the bug even when i specify figsize and dpi on the figure like so: fig = plt.figure(figsize=(2,2), dpi=300) -Ben -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Axes3D rotation not working when embedded in backend
I looked into this issue a little bit and found that the FigureCanvas must be set on the Figure before the 3D axes is instantiated. A simple re-ordering of the lines in the code below makes mouse rotation work again. # ... self.figure = Figure() self.canvas = FigureCanvas(self, -1, self.figure) #You must set up the canvas before creating the 3D axes self.axes = Axes3D(self.figure) # ... Perhaps this should be documented somehow? Or maybe a new mplot3d example code should be added. Or maybe Axes3D.mouse_init() should warn the user if self.figure.canvas is None. -Ben -Original Message- From: Ben Axelrod [mailto:baxel...@coroware.com] Sent: Monday, February 01, 2010 3:56 PM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Axes3D rotation not working when embedded in backend I would like to use Axes3D embedded in Wx. This works, but there is no mouse rotation. Clicking and dragging the mouse on the plot does not rotate the 3D axes like it does in the scatter3d_demo.py. I tried: WX, WXAgg, and TkAgg with similar results. Can this be fixed soon, or can someone point me to where I can try to fix it? I tested with the latest SVN tree on Linux and Windows. Thanks, -Ben Below is some sample code adapted from embedding_in_wx2.py, but with an Axes3D instead of the regular plot: #!/usr/bin/env python # adapted from example code embedding_in_wx2.py # Used to guarantee to use at least Wx2.8 import wxversion wxversion.ensureMinimal('2.8') import numpy as np import matplotlib # uncomment the following to use wx rather than wxagg #matplotlib.use('WX') #from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas # comment out the following to use wx rather than wxagg matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure from mpl_toolkits.mplot3d import Axes3D import wx class CanvasFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) self.SetBackgroundColour(wx.NamedColor(WHITE)) self.figure = Figure() self.axes = Axes3D(self.figure) xs = np.random.rand(100) ys = np.random.rand(100) zs = np.random.rand(100) self.axes.scatter(xs, ys, zs) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() self.add_toolbar() # comment this out for no toolbar def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top self.SetToolBar(self.toolbar) else: # On Windows platform, default window size is incorrect, so set # toolbar width to figure width. tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. self.toolbar.SetSize(wx.Size(fw, th)) self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() def OnPaint(self, event): self.canvas.draw() class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' frame = CanvasFrame() frame.Show(True) return True app = App(0) app.MainLoop() #end code -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros
Re: [Matplotlib-users] re ndering bug in bar3d
I completely understand how hard z sorting can be. However, I think the orthogonal planes that compose the parallel boxes is a pretty constrained problem that does not require a general solution. I might be able to lend a hand if I had some pointers where to get started in the mplot3d library. Thanks, -Ben -Original Message- From: Reinier Heeres [mailto:rein...@heeres.eu] Sent: Wednesday, February 03, 2010 6:10 PM To: Ben Axelrod; pierre-yves.debr...@bnpparibas.com; ben.r...@ou.edu Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] re ndering bug in bar3d Hi, Unfortunately z-sorting the polygons is a really hard problem. Or in fact, in the way it is currently implemented, an unsolvable problem. Please remember that mplot3d is not a full-blown 3d engine. Fixing this would require either a z-buffer or things such as BSP trees, which I do not think are feasible to implement. However, I do believe that there might be a small bug lurking somewhere or some other slight improvements to be made. I'll try to look into it after my 2 week holiday. Regards, Reinier On Thu, Jan 28, 2010 at 8:42 PM, baxelrod baxel...@coroware.com wrote: I am also seeing this behavior and it is unfortunately holding my project back. I have seen it with python 2.6 on Debian Linux and Windows XP. I have seen it in version 0.99.1 and the latest SVN tree (as of yesterday). I want to highlight a portion of each 3d bar with another color. This image shows what I want to do: http://old.nabble.com/file/p27358778/bar3d-1.png (http://www.benaxelrod.com/temp/bar3d-1.png) But rotating the view leads to rendering issues: http://old.nabble.com/file/p27358778/bar3d-2.png (http://www.benaxelrod.com/temp/bar3d-2.png) http://old.nabble.com/file/p27358778/bar3d-3.png (http://www.benaxelrod.com/temp/bar3d-3.png) In this example, the bars are drawn next to each other. Here is the source code to generate the images: # code adapted from: hist3d_demo.py from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = Axes3D(fig) x, y = np.random.rand(2, 100) * 4 hist, xedges, yedges = np.histogram2d(x, y, bins=4) elements = (len(xedges) - 1) * (len(yedges) - 1) xpos, ypos = np.meshgrid(xedges[:-1]+0.25, yedges[:-1]+0.25) xpos = xpos.flatten() ypos = ypos.flatten() zpos = np.zeros(elements) dx = 0.5 * np.ones_like(zpos) dy = dx.copy() dz = hist.flatten() dx = dx*0.5 xpos = xpos - dx ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b') ax.bar3d(xpos+dx, ypos, zpos, dx, dy, dz, color='r') ax.set_xlabel('X') ax.set_ylabel('Y') ax.set_zlabel('Z') plt.show() #end code I also tried to overlap the bars, but the result was even worse because from certain angles one of the colors was not visible at all. I thought that the issue might be due to calling bar3d muliple times. So I tried passing in an array of collors to bar3d with no luck. It seems that bar3d only takes a single color. Is this planned to be fixed so that bar3d() can take a color array just like bar()? Also note that even very simple examples demonstrate the bug. For example: http://old.nabble.com/file/p27358778/bar3d-4.png (http://www.benaxelrod.com/temp/bar3d-4.png) http://old.nabble.com/file/p27358778/bar3d-5.png (http://www.benaxelrod.com/temp/bar3d-5.png) Thanks, -Ben pierre-yves.debrito wrote: Hi, I am currently using this version : matplotlib-0.99.1.win32-py2.6.exe When I draw several Axes3D.bar3d in the same figure, as in this example, the faces are not drawn in the correct order. Did I do something wrong or is it a rendering bug? Is there a workaround? Thanks Pierre-Yves de Brito from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from numpy import array, arange contrib=[[0.18263,0.19098,0.16815,0.16295,0.09372,0.10505,0.15934], [0.00769,0.01315,0.01668,0.01645,0.03536,0.03493,0.00599], [0.47109,0.43646,0.43171,0.41794,0.14761,0.09472,0.21969], [0.25633,0.28820,0.34066,0.37184,0.68048,0.72773,0.57749], [0.06492,0.05539,0.03205,0.02151,0.03357,0.02411,0.01512]] print contrib[0] N = 7 ind = arange(N) # the x locations for the groups width = 0.1 # the width of the bars: can also be len(x) sequence I = array([1,1,1,1,1,1,1]) fig = plt.figure() ax = Axes3D(fig) for i in range(1,7): ax.bar3d(ind[i], 0, 0, 0.1, 0.1, contrib[0][i], color='b') ax.bar3d(array(ind[i])+0.15, 0, 0, 0.1, 0.1, contrib[1][i], color='r' ) ax.bar3d(array(ind[i])+2*0.15, 0, 0, 0.1, 0.1, contrib[2][i], color= 'g') ax.bar3d(array(ind[i])+3*0.15, 0, 0, 0.1, 0.1, contrib[3][i], color= 'c') ax.bar3d(array(ind[i])+4*0.15, 0, 0, 0.1, 0.1, contrib[4][i], color= 'm') plt.show() This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete
[Matplotlib-users] Error with Axes3D color param
I think I found a bug with in the Axes3D color support. When there are 3 or 4 points to plot, then the you cannot specify an array of rgba arrays for the colors of the points. I tested in matplotlib 0.99.1 and the latest code from SVN. Both exibit the bug. This simple code demonstrates the bug: #simple Axes3D example setting color and size of points import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from numpy.random import rand fig = plt.figure() ax = Axes3D(fig) n = 3 # ERROR WHEN n = 3 or 4 !! xs = np.random.rand(n) ys = np.random.rand(n) zs = np.random.rand(n) ss = np.random.rand(n) * 1000 cs = rand(n, 4) ax.scatter(xs, ys, zs, s=ss, c=cs) ax.set_xlabel('X Label') ax.set_ylabel('Y Label') ax.set_zlabel('Z Label') plt.show() #end code This is the call trace for the bug: Exception in Tkinter callback Traceback (most recent call last): File C:\Python26\lib\lib-tk\Tkinter.py, line 1410, in __call__ return self.func(*args) File C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 212, in resize self.show() File C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py, line 215, in draw FigureCanvasAgg.draw(self) File C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py, line314, in draw self.figure.draw(self.renderer) File C:\Python26\lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File C:\Python26\lib\site-packages\matplotlib\figure.py, line 773, in draw for a in self.axes: a.draw(renderer) File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py, line 150, in draw for col in self.collections] File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\art3d.py, line 290, in do_3d_projection self.set_facecolors(zalpha(self._facecolor3d, vzs)) File C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\art3d.py, line 497, in zalpha colors = [(c[0], c[1], c[2], c[3] * s) for c, s in zip(colors, sats)] IndexError: index out of bounds Thanks, -Ben -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Axes3D rotation not working when embedded in backend
I would like to use Axes3D embedded in Wx. This works, but there is no mouse rotation. Clicking and dragging the mouse on the plot does not rotate the 3D axes like it does in the scatter3d_demo.py. I tried: WX, WXAgg, and TkAgg with similar results. Can this be fixed soon, or can someone point me to where I can try to fix it? I tested with the latest SVN tree on Linux and Windows. Thanks, -Ben Below is some sample code adapted from embedding_in_wx2.py, but with an Axes3D instead of the regular plot: #!/usr/bin/env python # adapted from example code embedding_in_wx2.py # Used to guarantee to use at least Wx2.8 import wxversion wxversion.ensureMinimal('2.8') import numpy as np import matplotlib # uncomment the following to use wx rather than wxagg #matplotlib.use('WX') #from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas # comment out the following to use wx rather than wxagg matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure from mpl_toolkits.mplot3d import Axes3D import wx class CanvasFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) self.SetBackgroundColour(wx.NamedColor(WHITE)) self.figure = Figure() self.axes = Axes3D(self.figure) xs = np.random.rand(100) ys = np.random.rand(100) zs = np.random.rand(100) self.axes.scatter(xs, ys, zs) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() self.add_toolbar() # comment this out for no toolbar def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top self.SetToolBar(self.toolbar) else: # On Windows platform, default window size is incorrect, so set # toolbar width to figure width. tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. self.toolbar.SetSize(wx.Size(fw, th)) self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() def OnPaint(self, event): self.canvas.draw() class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' frame = CanvasFrame() frame.Show(True) return True app = App(0) app.MainLoop() #end code -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Label picker broken?
Thanks for the workaround. I got it to work for the labels and title, but not axes tick labels. This still seems like a regression bug to me. Especially since matplotlib's own example code clearly shows that picking labels, titles, and tick labels outside the axes region should be possible with the standard picker. If the current picker behavior is the desired behavior, then the example code should at least be updated to show the new way to pick objects outside the axes. Thanks again, -Ben From: Jae-Joon Lee [mailto:lee.j.j...@gmail.com] Sent: Monday, February 01, 2010 3:48 PM To: Ben Axelrod Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Label picker broken? Current pick implementation explicitly checks if the event is inside the axes. So, you cannot pick artists outside the axes area. This seems more like an intended feature than a bug, but I may be wrong. And my guess is that this is to prevent picking invisible artists (as they are clipped). While others may have better advice, mine is to use button pressed event directly. lab = ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) def picklabel(artsits, mouseevent): for a in artsits: a.pick(mouseevent) from functools import partial b1 = fig.canvas.mpl_connect('button_press_event', partial(picklabel, [lab])) Regards, -JJ On Fri, Jan 29, 2010 at 12:06 PM, Ben Axelrod baxel...@coroware.commailto:baxel...@coroware.com wrote: Picking text outside of the axes region seems to be broken in matplotlib 0.99.1 and in the latest SVN. This functionality used to work in version 0.98.3. The example code pick_event_demo.py demonstrates the issue. The ylabel in the red box is no longer pickable. Is there a clip_on or similar setting on the picker that needs to be set now? Below is a simplified version of pick_event_demo.py for reference. I also added some text to the plot to make sure that text inside the axes region was still pickable. Thanks, -Ben #!/usr/bin/env python # simplified example code: pick_event_demo.py from matplotlib.pyplot import figure, show from matplotlib.lines import Line2D from matplotlib.patches import Patch, Rectangle from matplotlib.text import Text from matplotlib.image import AxesImage import numpy as npy from numpy.random import rand fig = figure() ax1 = fig.add_subplot(111) ax1.set_title('click on points, rectangles or text', picker=True) ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) ax1.text(50, 0.5, pick me, picker=True) line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance def onpick1(event): if isinstance(event.artist, Line2D): thisline = event.artist xdata = thisline.get_xdata() ydata = thisline.get_ydata() ind = event.ind print 'onpick1 line:', zip(npy.take(xdata, ind), npy.take(ydata, ind)) elif isinstance(event.artist, Rectangle): patch = event.artist print 'onpick1 patch:', patch.get_path() elif isinstance(event.artist, Text): text = event.artist print 'onpick1 text:', text.get_text() fig.canvas.mpl_connect('pick_event', onpick1) show() #end code Ben Axelrod Robotics Engineer (800) 641-2676 x737 [cid:875170521@01022010-3682] www.coroware.comhttp://www.coroware.com/ www.corobot.nethttp://www.corobot.net/ -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.netmailto:Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users inline: image002.gif-- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Label picker broken?
Works for me! Although I did not test with Jorges's original code which caused the regression. Do you still want me to file a bug report so the issue is tracked? Thanks, -Ben -Original Message- From: John Hunter [mailto:jdh2...@gmail.com] Sent: Monday, February 01, 2010 5:47 PM To: Jae-Joon Lee Cc: Ben Axelrod; matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Label picker broken? Importance: Low On Mon, Feb 1, 2010 at 4:34 PM, John Hunter jdh2...@gmail.com wrote: On Mon, Feb 1, 2010 at 3:47 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: I agree. Unfortunately, event handling is not my specialty, and given no response from other developers, I recommend you file a bug (and hope other developers fix this). I wrote the original functionality and example and do consider this a regression, so do file a bug report and I'll try and get it fixed. Here is the bug report and fix that caused the current regression http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg11806.html The solution I propose is to do the axes comparison test only when the mouseevent.inaxes is not None (which happens when you are outside the axes rectangle). Then you could pick artists associated with an axes that are outside the rectangle, and still not get confused between two different axes with the same coord system. Try svn r8106. JDH -- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Label picker broken?
Picking text outside of the axes region seems to be broken in matplotlib 0.99.1 and in the latest SVN. This functionality used to work in version 0.98.3. The example code pick_event_demo.py demonstrates the issue. The ylabel in the red box is no longer pickable. Is there a clip_on or similar setting on the picker that needs to be set now? Below is a simplified version of pick_event_demo.py for reference. I also added some text to the plot to make sure that text inside the axes region was still pickable. Thanks, -Ben #!/usr/bin/env python # simplified example code: pick_event_demo.py from matplotlib.pyplot import figure, show from matplotlib.lines import Line2D from matplotlib.patches import Patch, Rectangle from matplotlib.text import Text from matplotlib.image import AxesImage import numpy as npy from numpy.random import rand fig = figure() ax1 = fig.add_subplot(111) ax1.set_title('click on points, rectangles or text', picker=True) ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) ax1.text(50, 0.5, pick me, picker=True) line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance def onpick1(event): if isinstance(event.artist, Line2D): thisline = event.artist xdata = thisline.get_xdata() ydata = thisline.get_ydata() ind = event.ind print 'onpick1 line:', zip(npy.take(xdata, ind), npy.take(ydata, ind)) elif isinstance(event.artist, Rectangle): patch = event.artist print 'onpick1 patch:', patch.get_path() elif isinstance(event.artist, Text): text = event.artist print 'onpick1 text:', text.get_text() fig.canvas.mpl_connect('pick_event', onpick1) show() #end code Ben Axelrod Robotics Engineer (800) 641-2676 x737 [cid:109365016@29012010-0A93] www.coroware.comhttp://www.coroware.com/ www.corobot.nethttp://www.corobot.net/ inline: image002.gif-- The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] word wrap
I am trying to draw some text inside of a rectangle. The text can be longer than the rectangle, so I would like to wrap the text. I doubt MPL has this kind of functionality built in, so I am expecting to write it myself. I think I read somewhere that it is not possible to get the length of text in MPL. Is this true? This would be the basic mechanism needed to implement this. I just want to know if this is possible or not, and any pointers if anyone has some. Thanks, -Ben - 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
[Matplotlib-users] clip text with a Rectangle
I want to draw some text and have it clipped by another rectangle I draw. The text should only display inside the box. I have some sample code that seems like it should work, but obviously there is something wrong because the text does not display at all. Any help? import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) mybar, = ax.bar(0,1) mytext = ax.text(0.5, 0.5, 'text inside box') mytext2 = ax.text(-0.3, 0.2, 'text outside box') ax.set_xlim(-1.5, 2.0) ax.set_ylim(-1.0, 2.5) fig.canvas.draw() # comment out these lines to see text mytext.set_clip_on(True) mytext.set_clip_box(mybar.get_bbox()) mytext2.set_clip_on(True) mytext2.set_clip_box(mybar.get_bbox()) plt.show() Thanks, -Ben - 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] Arrow Questions
Bump. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Axelrod Sent: Thursday, August 14, 2008 5:54 PM To: Matplotlib Subject: [Matplotlib-users] Arrow Questions I am trying to implement a dynamic graph in mpl, where users can drag around the nodes, and the edges follow the nodes like rubber bands. I have this working with regular edges, but I want to give the option of putting arrows on the edges. I am running into some issues with the Arrow classes. With my Text, Rectangle, and Line2D objects I can get and set their locations with methods such as get_position(), get_x(), and get_xdata() respectively. But there are no such methods for any of the Arrow classes. (By the way, it seems like these sorts of things would be in the base classes, and much more standard). What is the difference between Arrow, YAArrow, and FancyArrow anyway? (Besides drastically different scales). Some other features of the Arrow class that I would like very much are: * double headed arrows (one line with an arrow head on each end) * the ability to turn the arrow head on and off easily (Boolean parameter function) Does anyone have any ideas on how to work around these issues? Thanks, -Ben - 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
[Matplotlib-users] Arrow Questions
I am trying to implement a dynamic graph in mpl, where users can drag around the nodes, and the edges follow the nodes like rubber bands. I have this working with regular edges, but I want to give the option of putting arrows on the edges. I am running into some issues with the Arrow classes. With my Text, Rectangle, and Line2D objects I can get and set their locations with methods such as get_position(), get_x(), and get_xdata() respectively. But there are no such methods for any of the Arrow classes. (By the way, it seems like these sorts of things would be in the base classes, and much more standard). What is the difference between Arrow, YAArrow, and FancyArrow anyway? (Besides drastically different scales). Some other features of the Arrow class that I would like very much are: * double headed arrows (one line with an arrow head on each end) * the ability to turn the arrow head on and off easily (Boolean parameter function) Does anyone have any ideas on how to work around these issues? Thanks, -Ben - 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] Yticks off?
Try this: self.axes.set_yticks([]) From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Hayward, http://JonathansCorner.com; Sent: Wednesday, August 06, 2008 4:38 PM To: Matplotlib Subject: [Matplotlib-users] Yticks off? I am making a bar chart and want to turn off (visible) yticks. How can I remove, hide, color with white (the background color), etc., the yticks? Thanks, -- -- Jonathan Hayward, [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] ** To see an award-winning website with stories, essays, artwork, ** games, and a four-dimensional maze, why not visit my home page? ** All of this is waiting for you at http://JonathansCorner.com ++ Would you like to curl up with one of my hardcover books? ++ You can now get my books from http://CJSHayward.com - 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
[Matplotlib-users] 0.98.3 scatter plot color bug?
I get an error when I use the scatter plot and set the 'c' value to a list of 3-tuples. The error goes away if I use 4-tuples instead. Are colors with only 3 values not supported anymore? ... File C:\Python24\Lib\site-packages\matplotlib\axes.py, line 4807, in scatter colors = mcolors.colorConverter.to_rgba_array(c, alpha) File C:\Python24\Lib\site-packages\matplotlib\colors.py, line 343, in to_rgba_array c[i] = self.to_rgba(cc, alpha) # change in place ValueError: shape mismatch: objects cannot be broadcast to a single shape - 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] 0.98.3 scatter plot color bug?
Thanks, I think it is great that the color can be specified as either 3 or 4 columns. It would be nice if the bar plot color arguments also had this flexibility. They currently fail when the color has 4 columns. Will this bug fix need to wait until the next official release? (I am constrained to using the official releases and not the svn code). Thanks, -Ben -Original Message- From: Michael Droettboom [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2008 10:17 AM To: Ben Axelrod Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] 0.98.3 scatter plot color bug? Looks like a bug -- it should accept either 3 or 4 columns. I'll have a chance to look at this further this afternoon. Cheers, Mike Ben Axelrod wrote: I get an error when I use the scatter plot and set the 'c' value to a list of 3-tuples. The error goes away if I use 4-tuples instead. Are colors with only 3 values not supported anymore? ... File C:\Python24\Lib\site-packages\matplotlib\axes.py, line 4807, in scatter colors = mcolors.colorConverter.to_rgba_array(c, alpha) File C:\Python24\Lib\site-packages\matplotlib\colors.py, line 343, in to_rgba_array c[i] = self.to_rgba(cc, alpha) # change in place ValueError: shape mismatch: objects cannot be broadcast to a single shape - 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 -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.Net email is sponsored by the 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] Navigation toolbar w/o subplot configuration button
Yes. I did this by deriving my toolbar class from the default NavigationToolbar2WxAgg. Then deleting the buttons I did not want. I had to delete by position, because I did not know their IDs. (Does anyone know how to get the IDs of these standard buttons?) Sample code below: class VMToolbar(NavigationToolbar2WxAgg): def __init__(self, plotCanvas): NavigationToolbar2WxAgg.__init__(self, plotCanvas) # delete unwanted tools self.DeleteToolByPos(1) # Back Arrow self.DeleteToolByPos(1) # Forward Arrow (note this was position 2) self.DeleteToolByPos(3) # Divider (this was position 5) self.DeleteToolByPos(3) # Configure subplots (this was position 6) ... #end __init__ #end class -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of eliben Sent: Thursday, July 31, 2008 1:28 AM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Navigation toolbar w/o subplot configuration button Hello, I'm using mpl in a wxPython application to display plots dynamically. I want to let the users interact with the plots (zoom, move), but I don't need the subplot configuration button on the Navigation Toolbar. Can I instantiate the toolbar without this button ? TIA Eli -- View this message in context: http://www.nabble.com/Navigation-toolbar-w-o-subplot-configuration-button-tp18747977p18747977.html Sent from the matplotlib - users mailing list archive at Nabble.com. - 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 - 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
[Matplotlib-users] tool bar help / feature request
I am using the wxAgg backend with the NavigationToolbar2WxAgg toolbar. I would like to hook up a keyboard shortcut that will call the 'home' button on the toolbar. The only way I know to do this is the call the wx event with the ID of the home button. The problem is that this ID is not a member variable in the NavigationToolbar2Wx class. And I don't know of any wx method to get a toolbar button ID based on position. This is what line 1643 of backend_wx.py looks like: _NTB2_HOME=wx.NewId() self._NTB2_BACK=wx.NewId() self._NTB2_FORWARD =wx.NewId() self._NTB2_PAN =wx.NewId() self._NTB2_ZOOM=wx.NewId() _NTB2_SAVE= wx.NewId() _NTB2_SUBPLOT=wx.NewId() It would be great if _NTB2_HOME, _NTB2_SAVE, and _NTB2_SUBPLOT were also made to be member variables. Or if someone knows a better way, please let me know. Thanks, -Ben - 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
[Matplotlib-users] text picker
Text picking does not seem to work for me anymore since I upgraded from 0.91.4 to 0.98.1. These lines should set up the picker. They come straight from pick_event_demo.py ax1.set_title('click on points, rectangles or text', picker=True) ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red')) fig.canvas.mpl_connect('pick_event', onpick1) def onpick1(event): if isinstance(event.artist, Line2D): thisline = event.artist xdata = thisline.get_xdata() ydata = thisline.get_ydata() ind = event.ind print 'onpick1 line:', zip(npy.take(xdata, ind), npy.take(ydata, ind)) elif isinstance(event.artist, Rectangle): patch = event.artist print 'onpick1 patch:', patch.get_path() elif isinstance(event.artist, Text): text = event.artist print 'onpick1 text:', text.get_text() I apologize if this is a known issue. I tried searching the listserve, but did not find anything. -Ben - 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
[Matplotlib-users] bar plot picker with 0 height data
I get an exception when I set up a bar chart with a picker that has a bar with 0 height, and I click on the chart. Code to generate exception: from matplotlib.pyplot import figure, show import numpy as np def onpick1(event): print 'foo' fig = figure() ax = fig.add_subplot(111) xdata = [1, 2, 3] ydata = [1, 0, 3] #change to [1, 2, 3] and code will run fine ax.bar(xdata, ydata, picker = True) fig.canvas.mpl_connect('pick_event', onpick1) show() #now click on chart - Exception generated: Exception in Tkinter callback Traceback (most recent call last): File C:\Python24\lib\lib-tk\Tkinter.py, line 1345, in __call__ return self.func(*args) File C:\Python24\Lib\site-packages\matplotlib\backends\backend_tkagg.py, line 236, in button_press_event FigureCanvasBase.button_press_event(self, x, y, num, guiEvent=event) File C:\Python24\Lib\site-packages\matplotlib\backend_bases.py, line 1074, in button_press_event self.callbacks.process(s, mouseevent) File C:\Python24\Lib\site-packages\matplotlib\cbook.py, line 152, in process func(*args, **kwargs) File C:\Python24\Lib\site-packages\matplotlib\backend_bases.py, line 983, in pick self.figure.pick(mouseevent) File C:\Python24\Lib\site-packages\matplotlib\artist.py, line 226, in pick for a in self.get_children(): a.pick(mouseevent) File C:\Python24\Lib\site-packages\matplotlib\axes.py, line 2306, in pick martist.Artist.pick(self,args[0]) File C:\Python24\Lib\site-packages\matplotlib\artist.py, line 226, in pick for a in self.get_children(): a.pick(mouseevent) File C:\Python24\Lib\site-packages\matplotlib\artist.py, line 220, in pick inside,prop = self.contains(mouseevent) File C:\Python24\Lib\site-packages\matplotlib\patches.py, line 385, in contains x, y = self.get_transform().inverted().transform_point( File C:\Python24\Lib\site-packages\matplotlib\transforms.py, line 1840, in inverted return CompositeGenericTransform(self._b.inverted(), self._a.inverted()) File C:\Python24\Lib\site-packages\matplotlib\transforms.py, line 1338, in inverted self._inverted = Affine2D(inv(mtx)) File C:\Python24\Lib\site-packages\numpy\linalg\linalg.py, line 332, in inv return wrap(solve(a, identity(a.shape[0], dtype=a.dtype))) File C:\Python24\Lib\site-packages\numpy\linalg\linalg.py, line 235, in solve raise LinAlgError, 'Singular matrix' LinAlgError: Singular matrix -- Stats: MPL 0.98.1 Python 2.4.4 Numpy 1.1.0 I get the error on both Windows and Linux Thanks, -Ben - 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] bar plot picker with 0 height data
Thanks for the bug fix. Do you think this fix will make it into the 0.98.3 release? -Original Message- From: John Hunter [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2008 1:49 PM To: Ben Axelrod Cc: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] bar plot picker with 0 height data On Tue, Jul 29, 2008 at 12:27 PM, Ben Axelrod [EMAIL PROTECTED] wrote: I get an exception when I set up a bar chart with a picker that has a bar with 0 height, and I click on the chart. Thanks for the report -- I just committed a fix for this to svn r5922 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
[Matplotlib-users] upgrade problems
I am having problems plotting anything using version 0.98.1 on Linux Debian 4. But 0.91.4 works fine. When I try to plot something I get this error on the console: Traceback (most recent call last): File /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py, line 331, in expose_event self._render_figure(self._pixmap, w, h) File /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py, line 75, in _render_figure FigureCanvasAgg.draw(self) File /usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py, line 357, in draw self.renderer = self.get_renderer() File /usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py, line 368, in get_renderer self.renderer = RendererAgg(w, h, self.figure.dpi) File /usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py, line 116, in __init__ self.draw_polygon = self._renderer.draw_polygon AttributeError: draw_polygon And here is the configuration info from when I installed from src: BUILDING MATPLOTLIB matplotlib: 0.98.1 python: 2.4.4 (#2, Apr 15 2008, 23:43:20) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] platform: linux2 REQUIRED DEPENDENCIES numpy: 1.1.0 freetype2: 9.10.3 OPTIONAL BACKEND DEPENDENCIES libpng: 1.2.15beta5 Tkinter: Tkinter: 39220, Tk: 8.4, Tcl: 8.4 wxPython: 2.8.8.1 * WxAgg extension not required for wxPython = 2.8 Gtk+: gtk+: 2.8.20, glib: 2.12.4, pygtk: 2.8.6, pygobject: [pre-pygobject] Qt: Qt: 3.3.6, PyQt: 3.16 Qt4: no Cairo: 1.2.0 OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: present, version unknown pytz: 2006p OPTIONAL USETEX DEPENDENCIES dvipng: 1.9 ghostscript: 8.15.3 latex: 3.141592 pdftops: 3.00 EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES configobj: matplotlib will provide enthought.traits: no I am guessing that I am either missing a library or need an updated version. Does anyone have any ideas? Thanks, -Ben - 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
[Matplotlib-users] NaN bugs
I have noticed 2 bugs having to do with NaN handling in the scatter() function. And one other bug that seems to be in numpy. 1. The min and max for the axes are not computed properly when there are NaNs in the data. Example: import pylab as pl import numpy as np x = np.asarray([0, 1, 2, 3, None, 5, 6, 7, 8, 9], float) y = np.asarray([0, None, 2, 3, 4, 5, 6, 7, 8, 9], float) ax = pl.subplot(111) ax.scatter(x, y) pl.show() The points with NaN values are left out of the plot as expected, but you will see that everything before the NaN is ignored when computing the axis ranges. (The X axis goes from 4 to 10, cutting off some data, when it should be from -1 to 10. The Y axis goes from 1 to 10 when it should be also be from -1 to 10.) This is rather annoying since these simple calls fix the issue: ax.set_xlim(min(x), max(y)) ax.set_ylim(min(y), max(y)) 2. We see the same behavior for the 'c' axis. Example: import pylab as pl import numpy as np x = np.asarray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], float) y = np.asarray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], float) z = np.asarray([0, 1, 2, 3, 4, 5, None, 7, 8, 9], float) ax = pl.subplot(111) ax.scatter(x, y, c=z) pl.show() We see that everything before point 7 has zero color. And we can bandaid fix it by adding: ax.scatter(x, y, c=z, vmin=min(z), vmax=max(z)) Then only the one NaN point has zero color. 3. Both of the above mentioned bandaid fixes suffer from some bug (I think in numpy). Where the min() and max() of a numpy array where the first value is NaN, bugs out: x = np.asarray([None, 1, 2, 3, 4, 5, 6, 7, 8, 9], float) y = np.asarray([0, 1, 2, 3, 4, 5, 6, 7, 8, None], float) z = np.asarray([0, 1, 2, 3, 4, 5, None, 7, 8, 9], float) print min(x), max(x) #prints 1.#QNAN 1.#QNAN print min(y), max(y) #prints 0.0 8.0 print min(z), max(z) #pritns 0.0 9.0 FYI, I am using MatPlotLib version 0.91.4 and NumPy 1.1.0 on windows and Debian Linux. Thanks, -Ben - 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
[Matplotlib-users] scatter() / plot() alignment
I am trying to plot some 2D scatter plot data where: * the points have a colormap * some points have larger, colored circles on them * some points have a dark ring around them I have managed to get this functionality to work by using both the scatter() and plot() commands. My problem is that the dark rings printed by the plot() command do not line up with the circles of the scatter() command. (Example file below). My question is this: * Is there a way to set an offset for one of these plotting methods so that they line up properly? Setting it in the X/Y data will not work because it will not be scale independent. * Or is there a way to use only one plotting method? I can't seem to get plot() to draw different colors, and I can't get scatter() to draw a wide ring. Thanks, -Ben from pylab import * N = 30 x = 0.9*rand(N) y = 0.9*rand(N) z = 0.9*rand(N) w = 0.9*rand(N) scatter(x, y, c=z) scatter(x[:10], y[:10], s=120, c=w[:10], marker='o', alpha=0.4) plot(x[5:15], y[5:15], 'o', markersize=15, markeredgecolor='k', markeredgewidth=2, markerfacecolor='none') 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
[Matplotlib-users] small scatter plot color bug
It seems like this should be possible: ax.scatter(x, y, c=None) but axes chokes on the c=None parameter. - 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
[Matplotlib-users] difference between plot and scatter
It seems that axes.plot() handles 'None' values in the input arrays gracefully by just not plotting that point. But axes.scatter() bugs out. Can this be fixed? Thanks, -Ben - 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
[Matplotlib-users] RectangleSelector Feature Request
The RectangleSelector has parameters for the min span in the x and y directions of the rectangle. The units of these are the axes units. It would be nice if there was an additional similar min size requirement, but in units of pixels. This way it would be independent of the axes scale. Thanks, -Ben - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] debian install
I get errors when I add: deb http://anakonda.altervista.org/debian packages/ deb-src http://anakonda.altervista.org/debian sources/ to my /etc/apt/sources.list. Is this still the preferred method for installing on Debian? Thanks, -Ben - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plot3d
I am new to MatPlotLib and I saw in the archives that 3d plotting is no longer supported in version 0.98. This seems like a major feature drop to me. I would really like to use this feature. Does anyone know what must be done to get this working again? Thanks, -Ben - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users