Re: [Matplotlib-users] matplotlib 0.99.1rc1 available for testing
John, John Hunter wrote: > On Mon, Sep 14, 2009 at 10:13 AM, Werner F. Bruhin > wrote: > > >> Just installed it on Vista and saw the following issues so far. >> > > Hey Werner, thanks for the reports. > You are welcome - anyhow I think it would be more appropriate for me to thank you and everyone else involved in the mpl developement. Thanks really a great job and it keeps getting even better! ... >> - the issue with __doc__ handling in e.g. mlab.py is still present, see >> tracker item 2593149 and http://www.py2exe.org/index.cgi/MatPlotLib at the >> end of that page a work around is suggested >> > > This is not expected to be fixed until matplotlib 1.0. The changes > required to fix this are too pervasive for the 0.99 release branch, > where the emphasis is on stability. > > >> - backend_wx does a wxPython version check which does not work when the >> application is py2exe'd - tracker item 2858638 added and the above wiki page >> also contains a work around/correction suggestion. >> > > OK, we will take a look at this too. > Maybe instead of using "import wxversion" (I think its intent is for developers having multiple versions installed) you might wnat to change the code in backend_wx.py to use one of the following: import wx >>> wx.__version__ '2.8.10.1' >>> wx.version >>> wx.version() '2.8.10.1 (msw-unicode)' >>> wx.VERSION (2, 8, 10, 1, '') >>> wx.VERSION_STRING '2.8.10.1' This way you don't use wxversion and the check will run in all situations. Best regards Werner -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Strange error after installing matplotlib from macports
Hi All, After having installed Snow Leopard (10.6), I got some silly errors with libraries (installed via Macports) using deprecated functions Apple no longer supports, so I trashed the whole of Macports and reinstalled it. I then installed py25-matplotlib and get the following error message when trying the following >>> from matplotlib.figure import Figure Traceback (most recent call last): File "", line 1, in File "/opt/local/lib/python2.5/site-packages/matplotlib/figure.py", line 19, in from axes import Axes, SubplotBase, subplot_class_factory File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py", line 12, in import matplotlib.axis as maxis File "/opt/local/lib/python2.5/site-packages/matplotlib/axis.py", line 10, in import matplotlib.font_manager as font_manager File "/opt/local/lib/python2.5/site-packages/matplotlib/ font_manager.py", line 1301, in _rebuild() File "/opt/local/lib/python2.5/site-packages/matplotlib/ font_manager.py", line 1292, in _rebuild fontManager = FontManager() File "/opt/local/lib/python2.5/site-packages/matplotlib/ font_manager.py", line 1010, in __init__ self.afmlist = createFontList(self.afmfiles, fontext='afm') File "/opt/local/lib/python2.5/site-packages/matplotlib/ font_manager.py", line 578, in createFontList font = afm.AFM(fh) File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 294, in __init__ parse_afm(fh) File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 282, in parse_afm dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh) File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 168, in _parse_char_metrics bbox = _to_list_of_ints(vals[3][2:]) File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 47, in _to_list_of_ints return [_to_int(val) for val in s.split()] ValueError: invalid literal for int() with base 10: '836.364' I have no clue what is going on. Does anybody have any ideas? Regards, --Damon -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange error after installing matplotlib from macports
Damon McDougall writes: > >>> from matplotlib.figure import Figure > ValueError: invalid literal for int() with base 10: '836.364' > > I have no clue what is going on. Does anybody have any ideas? Could you do the following: (if you already exited that Python shell and can't reproduce the problem any longer, you can delete your ~/.matplotlib/fontList.cache and try again) from pdb import pm pm() This should get you to a debugger. Then type: up p fh p line p vals to get some more information on what is going wrong. -- Jouni K. Seppänen http://www.iki.fi/jks -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange error after installing matplotlib from macports
Hi Jouni, Sure. Here is the output from your suggestion: Python 2.5.4 (r254:67916, Sep 15 2009, 11:16:42) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from pdb import pm >>> from matplotlib.figure import Figure Traceback (most recent call last): File "", line 1, in File "/opt/local/lib/python2.5/site-packages/matplotlib/figure.py", line 19, in from axes import Axes, SubplotBase, subplot_class_factory File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py", line 12, in import matplotlib.axis as maxis File "/opt/local/lib/python2.5/site-packages/matplotlib/axis.py", line 10, in import matplotlib.font_manager as font_manager File "/opt/local/lib/python2.5/site-packages/matplotlib/ font_manager.py", line 1301, in _rebuild() File "/opt/local/lib/python2.5/site-packages/matplotlib/ font_manager.py", line 1292, in _rebuild fontManager = FontManager() File "/opt/local/lib/python2.5/site-packages/matplotlib/ font_manager.py", line 1010, in __init__ self.afmlist = createFontList(self.afmfiles, fontext='afm') File "/opt/local/lib/python2.5/site-packages/matplotlib/ font_manager.py", line 578, in createFontList font = afm.AFM(fh) File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 294, in __init__ parse_afm(fh) File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 282, in parse_afm dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh) File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 168, in _parse_char_metrics bbox = _to_list_of_ints(vals[3][2:]) File "/opt/local/lib/python2.5/site-packages/matplotlib/afm.py", line 47, in _to_list_of_ints return [_to_int(val) for val in s.split()] ValueError: invalid literal for int() with base 10: '836.364' >>> pm() > /opt/local/lib/python2.5/site-packages/matplotlib/afm.py(47) _to_list_of_ints() -> return [_to_int(val) for val in s.split()] (Pdb) up > /opt/local/lib/python2.5/site-packages/matplotlib/afm.py(168) _parse_char_metrics() -> bbox = _to_list_of_ints(vals[3][2:]) (Pdb) p fh (Pdb) p line 'C 0 ; WX 708.333 ; N Gamma ; B 0 0 836.364 684.027 ;' (Pdb) p vals ['C 0 ', ' WX 708.333 ', ' N Gamma ', ' B 0 0 836.364 684.027 '] Also, after some curiosity, I realised the file ~/.matplotlib/ fontList.cache doesn't exist. In fact, the ~/.matplotlib directory is empty, there aren't even any hidden files. On my other computer, matplotlib works fine and the ~/.matplotlib directory contains three files: fontList.cache, fontManager.cache and tex.cache. Hope this explains more. Thanks in advance for any help. Regards, --Damon On 15 Sep 2009, at 11:42, Jouni K. Seppänen wrote: > Damon McDougall writes: > > from matplotlib.figure import Figure >> ValueError: invalid literal for int() with base 10: '836.364' >> >> I have no clue what is going on. Does anybody have any ideas? > > Could you do the following: (if you already exited that Python shell > and can't reproduce the problem any longer, you can delete your > ~/.matplotlib/fontList.cache and try again) > > from pdb import pm > pm() > > This should get you to a debugger. Then type: > > up > p fh > p line > p vals > > to get some more information on what is going wrong. > > -- > Jouni K. Seppänen > http://www.iki.fi/jks > > > -- > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9-12, 2009. Register > now! > http://p.sf.net/sfu/devconf > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange error after installing matplotlib from macports
Damon McDougall writes: > (Pdb) p fh > (Pdb) p line > 'C 0 ; WX 708.333 ; N Gamma ; B 0 0 836.364 684.027 ;' Failing on this line is a bug in matplotlib, since the AFM spec says that bounding-box coordinates are "numbers", not "integers". Apparently not many AFM files use that precise bounding boxes, since we haven't run into this before. I don't know how the MacPorts packaging system would react to modifying installed files, but I imagine that applying the attached patch should fix this. > Also, after some curiosity, I realised the file ~/.matplotlib/ > fontList.cache doesn't exist. In fact, the ~/.matplotlib directory is > empty, there aren't even any hidden files. On my other computer, > matplotlib works fine and the ~/.matplotlib directory contains three > files: fontList.cache, fontManager.cache and tex.cache. Maybe the files just didn't get written into your directory, since matplotlib bailed out at the first failure. Index: lib/matplotlib/afm.py === --- lib/matplotlib/afm.py (revision 7750) +++ lib/matplotlib/afm.py (working copy) @@ -165,7 +165,8 @@ num = _to_int(vals[0].split()[1]) wx = _to_float(vals[1].split()[1]) name = vals[2].split()[1] -bbox = _to_list_of_ints(vals[3][2:]) +bbox = _to_list_of_floats(vals[3][2:]) +bbox = map(int, bbox) # Workaround: If the character name is 'Euro', give it the corresponding # character code, according to WinAnsiEncoding (see PDF Reference). if name == 'Euro': -- Jouni K. Seppänen http://www.iki.fi/jks -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Strange error after installing matplotlib from macports
Hi Jouni, Wow, that worked a treat. Thank you very much! Maybe you should post that to the -devel mailing list, too! On the computer that this bug didn't occur, the ~/Library/Fonts directory is completely empty! I wonder where it is looking for lcmssi8.afm if it isn't in ~/Library/Fonts Yeah I didn't want to play around with the installed files Macports creates, so I installed matplotlib from svn and, also since I don't know how to apply a patch, I just edited the afm.py to make your changes. This worked fine, and I no longer get the error! Also, as I now have produced a graph (just a sin wave) as a test, the ~/.matplotlib directory contains some files (fontList.cache and tex.cache). It seems as though these files are created to aid in the speed of producing plots in the future by saving previously produced text output. Thank you very much, Jouni! Regards, --Damon On 15 Sep 2009, at 12:49, Jouni K. Seppänen wrote: > Damon McDougall writes: > >> (Pdb) p fh >> > That's a font that probably came with a TeX distribution and somehow > got > installed in your font library. > >> (Pdb) p line >> 'C 0 ; WX 708.333 ; N Gamma ; B 0 0 836.364 684.027 ;' > > Failing on this line is a bug in matplotlib, since the AFM spec says > that bounding-box coordinates are "numbers", not "integers". > Apparently > not many AFM files use that precise bounding boxes, since we haven't > run > into this before. > > I don't know how the MacPorts packaging system would react to > modifying > installed files, but I imagine that applying the attached patch should > fix this. > >> Also, after some curiosity, I realised the file ~/.matplotlib/ >> fontList.cache doesn't exist. In fact, the ~/.matplotlib directory is >> empty, there aren't even any hidden files. On my other computer, >> matplotlib works fine and the ~/.matplotlib directory contains three >> files: fontList.cache, fontManager.cache and tex.cache. > > Maybe the files just didn't get written into your directory, since > matplotlib bailed out at the first failure. > > Index: lib/matplotlib/afm.py > === > --- lib/matplotlib/afm.py (revision 7750) > +++ lib/matplotlib/afm.py (working copy) > @@ -165,7 +165,8 @@ > num = _to_int(vals[0].split()[1]) > wx = _to_float(vals[1].split()[1]) > name = vals[2].split()[1] > -bbox = _to_list_of_ints(vals[3][2:]) > +bbox = _to_list_of_floats(vals[3][2:]) > +bbox = map(int, bbox) > # Workaround: If the character name is 'Euro', give it the > corresponding > # character code, according to WinAnsiEncoding (see PDF > Reference). > if name == 'Euro': > > -- > Jouni K. Seppänen > http://www.iki.fi/jks > -- > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart > your > developing skills, take BlackBerry mobile applications to market and > stay > ahead of the curve. Join us from November 9-12, 2009. Register > now! > http://p.sf.net/sfu/devconf___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Tutorial to object-oriented API
Hello, all tutorials I've found so far are about the stateful pylab API. Since I've never worked with Matlab and grew up with doing things in an OOP way using the pylab interface feels very unnatural for me. Are there any tutorials to matplotlib that utilise the more pythonic API? Just something to get started and to be able to comprehend the API documentation. Thanks, Florian -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Tutorial to object-oriented API
On Tue, Sep 15, 2009 at 8:10 AM, Florian Lindner wrote: > Hello, > > all tutorials I've found so far are about the stateful pylab API. > Since I've never worked with Matlab and grew up with doing things in > an OOP way using the pylab interface feels very unnatural for me. > > Are there any tutorials to matplotlib that utilise the more pythonic > API? Just something to get started and to be able to comprehend the > API documentation. The user's guide covers much of the API http://matplotlib.sourceforge.net/users/index.html thought it *starts* with a pyplot tutorial. In particular, see http://matplotlib.sourceforge.net/users/artists.html http://matplotlib.sourceforge.net/users/transforms_tutorial.html http://matplotlib.sourceforge.net/users/path_tutorial.html http://matplotlib.sourceforge.net/users/event_handling.html JDH -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Tutorial to object-oriented API
If you are just trying to get started, this might help: http://econpy.googlecode.com/svn/trunk/software4econ.xhtml#mpl_hints Ow, see John's list of suggestions. Alan Isaac -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib 0.99.1rc1 available for testing
>>> - backend_wx does a wxPython version check which does not work when the >>> application is py2exe'd - tracker item 2858638 added and the above wiki page >>> also contains a work around/correction suggestion. >>> >> OK, we will take a look at this too. >> > Maybe instead of using "import wxversion" (I think its intent is for > developers having multiple versions installed) you might wnat to change > the code in backend_wx.py to use one of the following: > import wx > >>> wx.__version__ > '2.8.10.1' > >>> wx.version > > >>> wx.version() > '2.8.10.1 (msw-unicode)' > >>> wx.VERSION > (2, 8, 10, 1, '') > >>> wx.VERSION_STRING > '2.8.10.1' > > This way you don't use wxversion and the check will run in all situations. I don't understand. You are correct that wxversion is used so that if multiple versions are installed, one that will work is the one that gets imported. This seems to be important functionality; it was added because people were having problems, and it seems to have solved those problems. It sounds like you are advocating going back to a simple version check. Instead, it looks to me like the best solution is the one you provided at the very bottom of http://www.py2exe.org/index.cgi/MatPlotLib. Eric -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib 0.99.1rc1 available for testing
Hi Eric, Eric Firing wrote: > - backend_wx does a wxPython version check which does not work when the application is py2exe'd - tracker item 2858638 added and the above wiki page also contains a work around/correction suggestion. >>> OK, we will take a look at this too. >>> >> Maybe instead of using "import wxversion" (I think its intent is for >> developers having multiple versions installed) you might wnat to >> change the code in backend_wx.py to use one of the following: >> import wx >> >>> wx.__version__ >> '2.8.10.1' >> >>> wx.version >> >> >>> wx.version() >> '2.8.10.1 (msw-unicode)' >> >>> wx.VERSION >> (2, 8, 10, 1, '') >> >>> wx.VERSION_STRING >> '2.8.10.1' >> >> This way you don't use wxversion and the check will run in all >> situations. > > I don't understand. You are correct that wxversion is used so that if > multiple versions are installed, one that will work is the one that > gets imported. This seems to be important functionality; it was added > because people were having problems, and it seems to have solved those > problems. It sounds like you are advocating going back to a simple > version check. Unless I misread the code it just wants to ensure that at least version 2.8 is used, this could be done using any of the above variables. Only things wxversion is doing in addition is to propose to download and for a developer if he is having a default of < 2.8 it will load 2.8 or higher if available. > > Instead, it looks to me like the best solution is the one you provided > at the very bottom of http://www.py2exe.org/index.cgi/MatPlotLib. I am happy with what ever change is done as long as it also works for py2exe'd application. Werner > > Eric > > -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] DO NOT round values
Hello everyone, when I plot, just for example, a pie graph with two values: 63.7 and 36.3, matplotlib rounds this values to 64 and 36. What I must do for matplotlib DO NOT round those values? Thanks -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] DO NOT round values
For pie graphs, you can pass a "autopct" keyword argument, which is a format string for the values. For example: pie([63.7, 36.3], autopct="%.03f") will display the values with 3 decimal places. Cheers, Mike Gewton Jhames wrote: > Hello everyone, > when I plot, just for example, a pie graph with two values: 63.7 and > 36.3, matplotlib rounds this values to 64 and 36. > What I must do for matplotlib DO NOT round those values? > Thanks > > > -- > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > > > ___ > 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 -- Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users