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?
Partial correction to my previous post: is_string_like looks for a TypeError or ValueError to be raised. I suppose we could look for any exception, since your object raises a RuntimeError. I wonder whether it would be equally effective and more robust if the test were try: '' + obj instead of the other way around. 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