Yes, I think this is the origin of the Error.
Thank you all!
BTW, why the email title of all other people posts begin with
'[matplotlib-user]'? does this should be added by hand every time when I
post a topic?
On Sat, Jan 7, 2012 at 11:44 AM, Michiel de Hoon <mjldeh...@yahoo.com>wrote:
> The problem seems to originate from this line in lib/matplotlib/sankey.py:
>
> patch = PathPatch(Path(vertices, codes),
> fc=kwargs.pop('fc', kwargs.pop('facecolor',
> '#bfd1d4')), # Custom defaults
> lw=kwargs.pop('lw', kwargs.pop('linewidth',
> '0.5')),
> **kwargs)
>
> Note that the linewidth is set to the string '0.5' rather than the float
> 0.5. gc.set_linewidth is then called with the string '0.5' as the argument,
> which triggers the error. If I replace '0.5' by 0.5, the example runs fine
> with the MacOSX backend.
>
> Is there a reason why this needs to be a string here? I would think that
> in general gc.set_linewidth should only accept floats and ints.
>
> -Michiel.
>
>
>
>
> --- On *Fri, 1/6/12, Mingkui Li <ken.mk...@gmail.com>* wrote:
>
>
> From: Mingkui Li <ken.mk...@gmail.com>
> Subject: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is
> required" problem
> To: matplotlib-users@lists.sourceforge.net
> Date: Friday, January 6, 2012, 10:54 AM
>
>
> I just updated matplotlib to 1.1 and want try the new features Sankey
> Diagrams
>
> and
> Animation
>
> but when I try the api example code: sankey_demo_basics.py
>
> I got the error messages as below:
>
> ==============================================================================
> Traceback (most recent call last):
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/artist.py",
> line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/figure.py",
> line 884, in draw
> func(*args)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/artist.py",
> line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/axes.py",
> line 1983, in draw
> a.draw(renderer)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/artist.py",
> line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/patches.py",
> line 385, in draw
> gc.set_linewidth(lw)
> TypeError: a float is required
> Traceback (most recent call last):
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/artist.py",
> line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/figure.py",
> line 884, in draw
> func(*args)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/artist.py",
> line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/axes.py",
> line 1983, in draw
> a.draw(renderer)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/artist.py",
> line 55, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File
> "/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/patches.py",
> line 385, in draw
> gc.set_linewidth(lw)
> TypeError: a float is required
>
> ==================================================================================
>
> Then I looked into the
> file
> /Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/matplotlib/patches.py
> at the line 384 the code is: gc.set_linewidth(lw)
> I added "lw = np.float(lw)" before "gc.set_linewidth(lw)", then the
> example code runs successfully.
>
> Any help?
>
> Thanks for any reply.
>
> --
> Mingkui Li
>
>
> -----Inline Attachment Follows-----
>
>
>
> ------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
>
> -----Inline Attachment Follows-----
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net<http://mc/compose?to=Matplotlib-users@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Mingkui Li
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users