-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: constrained_layout_pads as kwargs of Figure #22029
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
Comments
Thanks for opening this here. See also #20115 (comment) |
xref #20115 (comment) Matplotlib matplotlib/lib/matplotlib/artist.py Lines 1053 to 1077 in b57506e
Thus we can write things like ax.plot(x, y, linewidth=5, color='green') rather than ln, = ax.plot(x, y)
ln.set_linewidth(5)
ln.set_color('green') This works on the expectation that a) for a keyword One fix would be to exclude def set_constrained_layout_pads(self, d=None, /, *,
w_pad=None, h_pad=None,
wspace=None, hspace=None): which along with a bit of munging in body can make this work as @StefRe expected. |
Right, the unexpected thing for me was that this turned up in the docs - obviously we never meant this to be a kwarg for Anyhow, I'm fine w/ the going forward 3.8+ plan. It'd be great to accept a dict as a kwarg. I'm a little concerned that we need to do something for MPL 3.5.x about the documentation. Can we just define |
I think if we go with @anntzer 's suggestion of filtering on |
This will be easier to handle once we define artist properties explicitly. Xref proposal in #22749 |
Bug summary
According to the figure documentation (other parameters) it should be possible pass
figure
kwargs inplt.subplots()
:which results, however, in a
TypeError: set_constrained_layout_pads() takes 1 positional argument but 2 were given
The documentation mentions a single value (
float
), although the parameter name is in plural (and set_constrained_layout_pads takes up to four parameters):but
plt.subplots(constrained_layout_pads=0.5)
results in the same error.Code for reproduction
Actual outcome
Expected outcome
no error
Additional information
also discussed at discours
Operating system
Arch
Matplotlib Version
3.5.1
Matplotlib Backend
Qt5Agg
Python version
3.10.1
Jupyter version
No response
Installation
Linux package manager
The text was updated successfully, but these errors were encountered: