[Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread Mingkui Li
I just updated matplotlib to 1.1 and want try the new featuresSankey
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
--
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


Re: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread Michael Droettboom
I suspect this bug is specific to the macosx backend.  Can you switch to 
another backend and confirm it doesn't happen there?  (I can't reproduce 
it on Linux).


Mike

On 01/06/2012 10:54 AM, Mingkui Li wrote:

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



--
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


--
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


Re: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread David Hoese
I experienced the same problem on the macosx backend, switched to Qt4Agg 
and no problems.

 import matplotlib
 matplotlib.use("Qt4Agg")

-Dave

On 1/6/12 10:08 AM, md...@stsci.edu wrote:
> I suspect this bug is specific to the macosx backend.  Can you switch to
> another backend and confirm it doesn't happen there?  (I can't reproduce
> it on Linux).
>
> Mike


--
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


Re: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread Mingkui Li
Thank you, Mike.
I'll try the Linux version to find out.

On Sat, Jan 7, 2012 at 12:06 AM, Michael Droettboom  wrote:

>  I suspect this bug is specific to the macosx backend.  Can you switch to
> another backend and confirm it doesn't happen there?  (I can't reproduce it
> on Linux).
>
> Mike
>
>
> On 01/06/2012 10:54 AM, Mingkui Li wrote:
>
> 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
>
>
>
> --
> 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 
> listMatplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> --
> 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
>
>


-- 
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___

Re: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread Mingkui Li
Hi, Dave,

I tried the two lines of code you posted, but when I ran the example I
mentioned above I got such error:

ImportError: No module named sip

Seems I can't import any other libs from matplotlib after
"matplotlib.use("Qt4Agg")"

I'm kind of a newbie, sorry.

Ken


On Sat, Jan 7, 2012 at 12:22 AM, David Hoese  wrote:

> I experienced the same problem on the macosx backend, switched to Qt4Agg
> and no problems.
>
> import matplotlib
> matplotlib.use("Qt4Agg")
>
> -Dave
>
> On 1/6/12 10:08 AM, md...@stsci.edu wrote:
> > I suspect this bug is specific to the macosx backend.  Can you switch to
> > another backend and confirm it doesn't happen there?  (I can't reproduce
> > it on Linux).
> >
> > Mike
>
>
>
> --
> 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
>



-- 
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


Re: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread David Hoese

Hi Ken,

You're getting that error because you probably don't have Qt4 installed 
on your Mac (I do).  I'm not sure what backends come with matplotlib and 
will work for you (maybe someone here knows).  You can use any of the 
following:


GTK GTKAgg GTKCairo CocoaAgg FltkAgg
MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template

Like Qt4, some of those may need to be installed.  I also have Gtk 
installed (never used it before) and "GTKAgg" works for me, but not 
"GTK".  It's also important to know that not all of those backends are 
interactive (they don't all show a window) and the figure must be saved 
to a file.


Also make sure that the 2 lines I provided need to be BEFORE any other 
matplotlib/pyplot imports.  Hope you find something that works for you, 
at least until the macosx bug is fixed.  I'm not an expert, sorry.


-Dave

On 1/6/12 10:35 AM, Mingkui Li wrote:

Hi, Dave,

I tried the two lines of code you posted, but when I ran the example I 
mentioned above I got such error:


ImportError: No module named sip

Seems I can't import any other libs from matplotlib after 
"matplotlib.use("Qt4Agg")"


I'm kind of a newbie, sorry.

Ken


On Sat, Jan 7, 2012 at 12:22 AM, David Hoese > wrote:


I experienced the same problem on the macosx backend, switched to
Qt4Agg
and no problems.

import matplotlib
matplotlib.use("Qt4Agg")

-Dave

On 1/6/12 10:08 AM, md...@stsci.edu  wrote:
> I suspect this bug is specific to the macosx backend.  Can you
switch to
> another backend and confirm it doesn't happen there?  (I can't
reproduce
> it on Linux).
>
> Mike



--
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




--
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


Re: [Matplotlib-users] cycling mechanism

2012-01-06 Thread Benjamin Root
On Thu, Jan 5, 2012 at 3:18 PM, Ryan May  wrote:

> On Thu, Jan 5, 2012 at 2:59 PM, Daniel Hyams  wrote:
> > Right, __slots__ is definitely not a good idea to use except in very
> > specific situations.  I would strongly recommend against its usage here.
> >
> > http://groups.google.com/group/comp.lang.python/msg/0f2e859b9c002b28
>
> I see that now.  I had seen __slots__ used in a namedtuple example (in
> the Python docs) and assumed it was a good idea.  The same idea could
> be achieved by using an internal _fields list and overriding
> __getattr__ if the fixed list of attributes was deemed a useful
> feature.
>
> Ryan
>
> >
> >
> >
> > On Thu, Jan 5, 2012 at 3:50 PM, Eric Firing  wrote:
> >>
> >> On 01/05/2012 07:34 AM, Ryan May wrote:
> >> > On Thu, Jan 5, 2012 at 10:58 AM, Benjamin Root
>  wrote:
> >> >>
> >> >>
> >> >> On Thu, Jan 5, 2012 at 10:40 AM, Benjamin Root
>  wrote:
> >> >>>
> >> >>>
> >>  At the very least, it would help in compartmentallizing all the
> >>  possible
> >>  drawing attributes that are common across all artists.  Currently,
> I
> >>  am
> >>  envisioning using a defaultdict object (which was introduced in
> >>  python 2.5)
> >>  or subclassing from it.  This might help in keeping compatibility
> >>  with
> >>  existing code.  Subclassing would allow for modifying __get__ and
> >>  __set__ to
> >>  treat some elements like 'c' and 'color', 'lw' and 'linewidth' and
> so
> >>  on as
> >>  the same.
> >> >>
> >> >>
> >> >> G, in defaultdict(), the default_factory is called without
> >> >> arguments, so
> >> >> a factory can't be made to produce a default value for a given key,
> >> >> unless I
> >> >> resort to more hackary...
> >> >
> >> > Might be better to explicitly use properties for this rather than
> >> > overriding dict:
> >> >
> >> > class Style(object):
> >> >  __slots__ = ('_lw')
> >> >
> >> >  def __init__(self, lw=None):
> >> >  self.lw = lw
> >> >
> >> >  def _set_linewidth(self, lw):
> >> >  self._lw = lw
> >> >
> >> >  def _get_linewidth(self):
> >> >  return self._lw
> >> >
> >> >  lw = property(_get_linewidth, _set_linewidth)
> >> >  linewidth = property(_get_linewidth, _set_linewidth)
> >> >
> >> > Declaring slots allows you to keep the available attributes to those
> >> > explicity listed. This way, you can't set a random (misspelled?)
> >> > attribute and wonder for hours why style.edgcolor = 'blue' doesn't
> >> > work.
> >>
> >> This seems useful, and may be OK for this application; but a little
> >> googling indicates that it is not really what __slots__ was intended
> >> for, it is at best controversial, and it should be used very sparingly
> >> and carefully.
> >>
> >> Eric
> >>
> >> >
> >> > Ryan
> >> >
> >>
> >>
>

Some thoughts I have had while trying to tackle this problem:

1) Major difficulty is that different plotting functions currently have
different default values for various parameters. For example, spy() uses a
square marker by default. Furthermore, there are differences in how
plotting functions determine default-ness.

1.1 - call signature uses **kwarg
Therefore, if something like 'c' is in kwarg, then it gets popped and
used.  If not, then sometimes a None is used which then means some sort of
default elsewhere, or a value from a cycle somewhere is extracted.

1.2 - call signature uses prop=None idiom
Therefore, it is impossible to know if the user explicitly wanted the
default property value or did not pass anything in.

1.3 - call signature explicitly sets a default (i.e., fmt="b-") in call
signature
This prevents being able to extract a default value from a rcparam unless
the user explicitly passes None. Therefore, it is difficult to have common
style across all plots with a common/similar function calls.  Sometimes,
you explicitly pass None, sometimes you don't.

2) Plot property information being mixed in with the core process of
creating plot elements.  This makes the process of making sure that all
desired properties are applied in a uniform and consistent manner.  If each
function could break its job into two basic parts: create plot elements for
each dataset, apply style properties for each dataset plotted.  In other
words, for creating a bar chart, the process should first create Rectangle
patches that places them at the correct locations and sized correctly
(information that is based entirely on the dataset), but they would have no
color, linewidth, hatch, etc. information yet.  Then, styles are applied to
each before returning them to the user.

3) rcparam naming.  I wanted to name things like "cycle.color" and
"cycle.marker", however, we currently have "axes.color_cycle".  While I am
fine with continuing this naming convention, do we want to codify a set of
naming rules for future additions, or can they continue to be named anyway
we wish?

No matter how I look at this problem, we are looking at significant
behavioral changes a

Re: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread Michael Droettboom

I've filed a bug for this here:

https://github.com/matplotlib/matplotlib/issues/662

Mike

On 01/06/2012 11:55 AM, David Hoese wrote:

Hi Ken,

You're getting that error because you probably don't have Qt4 
installed on your Mac (I do).  I'm not sure what backends come with 
matplotlib and will work for you (maybe someone here knows).  You can 
use any of the following:

GTK GTKAgg GTKCairo CocoaAgg FltkAgg
MacOSX QtAgg Qt4Agg TkAgg WX WXAgg Agg Cairo GDK PS PDF SVG Template
Like Qt4, some of those may need to be installed.  I also have Gtk 
installed (never used it before) and "GTKAgg" works for me, but not 
"GTK".  It's also important to know that not all of those backends are 
interactive (they don't all show a window) and the figure must be 
saved to a file.


Also make sure that the 2 lines I provided need to be BEFORE any other 
matplotlib/pyplot imports.  Hope you find something that works for 
you, at least until the macosx bug is fixed.  I'm not an expert, sorry.


-Dave

On 1/6/12 10:35 AM, Mingkui Li wrote:

Hi, Dave,

I tried the two lines of code you posted, but when I ran the example 
I mentioned above I got such error:


ImportError: No module named sip

Seems I can't import any other libs from matplotlib after 
"matplotlib.use("Qt4Agg")"


I'm kind of a newbie, sorry.

Ken


On Sat, Jan 7, 2012 at 12:22 AM, David Hoese > wrote:


I experienced the same problem on the macosx backend, switched to
Qt4Agg
and no problems.

import matplotlib
matplotlib.use("Qt4Agg")

-Dave

On 1/6/12 10:08 AM, md...@stsci.edu  wrote:
> I suspect this bug is specific to the macosx backend.  Can you
switch to
> another backend and confirm it doesn't happen there?  (I can't
reproduce
> it on Linux).
>
> Mike



--
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




--
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


--
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


[Matplotlib-users] Contour label positioning

2012-01-06 Thread Gökhan Sever
Hello group,

I am trying to align contour labels on my plot. Using the latest git clone
I was able to position the labels somewhat nicer than the default
positioning.
(Following from https://github.com/matplotlib/matplotlib/issues/613 )
However, it requires manual specification of right data coords to create
this plot and it is not easy to align them properly.
Is there a mechanism to position and align labels on a specified line? See
the linked image for better demonstration.

http://imageshack.us/photo/my-images/210/cimage.png/

Thanks

-- 
Gökhan
--
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


Re: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread Michiel de Hoon
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  wrote:

From: Mingkui Li 
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
--
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 maili

Re: [Matplotlib-users] matplotlib 1.1 "TypeError: a float is required" problem

2012-01-06 Thread Mingkui Li
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 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 * wrote:
>
>
> From: Mingkui Li 
> 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
>