Skip to content
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

plt.subplots crashes when handed fig_kw argument #8078

Closed
dstansby opened this issue Feb 15, 2017 · 2 comments · Fixed by #8489
Closed

plt.subplots crashes when handed fig_kw argument #8078

dstansby opened this issue Feb 15, 2017 · 2 comments · Fixed by #8489
Milestone

Comments

@dstansby
Copy link
Member

dstansby commented Feb 15, 2017

Current docs (http://matplotlib.org/devdocs/api/pyplot_api.html#matplotlib.pyplot.subplots) list fig_kw as one of the arguments that can be passed to plt.subplots, however this fails with:

import matplotlib.pyplot as plt
fig, axs = plt.subplots(1, 2, fig_kw={'figsize': (15, 8)})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dstansby/matplotlib/lib/matplotlib/pyplot.py", line 1190, in subplots
    fig = figure(**fig_kw)
  File "/home/dstansby/matplotlib/lib/matplotlib/pyplot.py", line 544, in figure
    **kwargs)
  File "/home/dstansby/matplotlib/lib/matplotlib/backends/backend_qt5agg.py", line 43, in new_figure_manager
    thisFig = FigureClass(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'fig_kw'

Either the docs should be updated to note that anything extra handed to plt.subplots is handed to plt.figure, or fig_kw should be an allowed argument.

@dopplershift
Copy link
Contributor

fig_kw isn't documented as a keyword argument itself--what it's saying is that all additional kwargs are passed onto the Figure constructor.

@dopplershift
Copy link
Contributor

Oh, now I see that it's listed as an optional dict in the parameters section--that part should be changed to reflect what I said above.

@QuLogic QuLogic added this to the 2.1 (next point release) milestone Apr 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants