Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Drawing a histplot crashes deeply inside matplotlib #2096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mmokrejs opened this issue May 30, 2013 · 4 comments
Closed

Drawing a histplot crashes deeply inside matplotlib #2096

mmokrejs opened this issue May 30, 2013 · 4 comments
Milestone

Comments

@mmokrejs
Copy link

I don't have the time right now to come up with a standalone example but I fear I have somewhere an empty list in my dataset(s). anyway, please improve your data input controls in your functions so that the code does not dive so deeply.

File ..., line 9688, in draw_hist_plot
_figure.savefig(filename, dpi=100)
File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1370, in savefig
self.canvas.print_figure(_args, *_kwargs)
File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 2096, in print_figure
*_kwargs)
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 492, in print_png
FigureCanvasAgg.draw(self)
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 440, in draw
self.figure.draw(self.renderer)
File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 54, in draw_wrapper
draw(artist, renderer, *args, *_kwargs)
File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 940, in draw
self.tight_layout(renderer)
File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1543, in tight_layout
rect=rect)
File "/usr/lib64/python2.7/site-packages/matplotlib/tight_layout.py", line 352, in get_tight_layout_figure
pad=pad, h_pad=h_pad, w_pad=w_pad)
File "/usr/lib64/python2.7/site-packages/matplotlib/tight_layout.py", line 131, in auto_adjust_subplotpars
fig.transFigure.inverted())
File "/usr/lib64/python2.7/site-packages/matplotlib/transforms.py", line 1645, in inverted
self._inverted = Affine2D(inv(mtx), shorthand_name=shorthand_name)
File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 445, in inv
return wrap(solve(a, identity(a.shape[0], dtype=a.dtype)))
File "/usr/lib64/python2.7/site-packages/numpy/linalg/linalg.py", line 328, in solve
raise LinAlgError('Singular matrix')
numpy.linalg.linalg.LinAlgError: Singular matrix

This is mpl-1.2.1.

@mmokrejs
Copy link
Author

OK, my problem was that _subfigs was 0. That in turn broke the following:

_figure.set_size_inches(11.2, 8.4 * _subfigs)

and later on _figure.savefig(filename, dpi=100) crashed.

Hope this helps,
Martin

@WeatherGod
Copy link
Member

Ok, so, it looks like set_size_inches() needs to check for a zero. That
should be easy enough to add.

@mdboom
Copy link
Member

mdboom commented May 31, 2013

Agreed. In the long term, I hope MEP13 will mean that values are validated earlier in cases like this.

@dmcdougall
Copy link
Member

It'd be nice to fix this in v1.3, so I'm going to add a milestone for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants