Neal Becker wrote:
>     pylab.plot (xaxis, log10 (the_sum)*10)
> where xaxis is numpy array, and log10(the_sum)*10 is my own class that is a 
> valid python sequence (it is a c++ wrapper around boost::ublas), gives:
>   File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
> x86_64.egg/matplotlib/pyplot.py", line 2096, in plot
>     ret =  gca().plot(*args, **kwargs)
>   File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
> x86_64.egg/matplotlib/axes.py", line 3277, in plot
>     for line in self._get_lines(*args, **kwargs):
>   File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
> x86_64.egg/matplotlib/axes.py", line 394, in _grab_next_args
>     for seg in self._plot_2_args(remaining, **kwargs):
>   File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
> x86_64.egg/matplotlib/axes.py", line 267, in _plot_2_args
>     if is_string_like(tup2[1]):
>   File "/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-
> x86_64.egg/matplotlib/cbook.py", line 277, in is_string_like
>     try: obj + ''
> RuntimeError: check:: failed
> 
> If I convert the 2nd arg to array, it works:
>    pylab.plot (xaxis, np.array(log10 (the_sum)*10))
> 
> Doesn't plot support arbitrary sequences?

Not *completely* arbitrary, evidently.  It has to raise a Python 
exception when an invalid operation (specifically, adding an empty 
string) is attempted.  Apparently your wrapper is not doing this.  This 
is the duck-typing check for a string that mpl has used from early times.

Eric

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to