SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] SystemError exception calling agg's draw_path_collection()

From: Benjamin R. <ben...@ou...> - 2015年02月09日 00:56:13
I think I figured it out... the linestyles are a list of tuples. When they
get coerced to a numpy array, and then coerced back to a list, you get a
list of lists instead of a list of tuples!
There must be some code deep down in the agg that is expecting a tuple, and
choking on a list.
Ben Root
On Sun, Feb 8, 2015 at 5:54 PM, Benjamin Root <ben...@ou...> wrote:
> I am experimenting with my idea for utilizing a _draworder attribute in
> Collection objects. Since not everything in a collection is guaranteed to
> be the same length or even be numpy arrays, I have to add some logic to
> coerce everything to numpy arrays and tile their data so that the length of
> their first axis match up.
>
> I also have logic to convert all objects back to their original types
> prior to continuing, just in case that makes any difference.
>
> However, using AGG seems to fail here:
>
> Traceback (most recent call last):
> File "/home/ben/miniconda/lib/python2.7/site-packages/nose/case.py",
> line 197, in runTest
> self.test(*self.arg)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/testing/decorators.py",
> line 51, in failer
> result = f(*args, **kwargs)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/testing/decorators.py",
> line 183, in do_test
> figure.savefig(actual_fname, **self._savefig_kwarg)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py",
> line 1490, in savefig
> self.canvas.print_figure(*args, **kwargs)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py",
> line 2211, in print_figure
> **kwargs)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py",
> line 525, in print_png
> FigureCanvasAgg.draw(self)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py",
> line 472, in draw
> self.figure.draw(self.renderer)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py",
> line 60, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/figure.py",
> line 1094, in draw
> func(*args)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/mpl_toolkits/mplot3d/axes3d.py",
> line 273, in draw
> ax.draw(renderer)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/mpl_toolkits/mplot3d/axis3d.py",
> line 370, in draw
> self.gridlines.draw(renderer, project=True)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/mpl_toolkits/mplot3d/art3d.py",
> line 203, in draw
> LineCollection.draw(self, renderer)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/artist.py",
> line 60, in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/collections.py",
> line 345, in draw
> self._offset_position)
> File
> "/home/ben/miniconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-linux-x86_64.egg/matplotlib/backends/backend_agg.py",
> line 127, in draw_path_collection
> return self._renderer.draw_path_collection(*kl, **kw)
> SystemError: new style getargs format but argument is not a tuple
>
> The PDF and SVG backends aren't experiencing this problem. I have taken
> out the parts of my code that "broadcasted" the arrays, and the error still
> happens. I then took out the code that coerced everything to numpy arrays
> in the first place, and the error disappeared (taking that out effectively
> let everything pass through unaffected). Keep in mind that my code coerced
> everything back to their original types prior to calling the renderer, so
> it was merely the action of converting stuff into an array that did this.
>
> The best I can figure is that there is something wrong with the C++ code
> for our agg wrapper? Googling the exception message brings up various
> discussions of mistakes in the argument handling of C/C++ code. I haven't a
> clue, though, why this would be an issue.
>
> Thoughts?
> Ben Root
>
>

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /