-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
make subplots smarter with regards to subplot_kw and figure_kw #1460
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
While working on matplotlib#1460, I've found that the `__init__` of `_BaseAxes` takes some redundant arguments. Of the 7 arguments it takes, 3 (`xscale, yscale, label`) can be removed without harm, because they are automatically used in `update(kwargs)` (they have matching `set_` methods). Another two have different names as setters: `frameon` == `frame_on` and `axisbg` ~ `axis_bgcolor`. Note that the later are mispelled, as they refer to axes and not axis. The following call is actually legal: plt.subplot(111, axisbg='green', axis_bgcolor='red') I do not know what to do with the other two arguments. (`sharex` `sharey`) I've tried to remove this redunancy, keeping the old defaults intact, and without breaking the api. My opinion is that axisbg and frameon should be reomved, but api changes and deprectations are above my level. See also issue matplotlib#1460
Still looks valid as of 1.5.3. This seems to be an elegance concern, would think about the priority of this. Relevant: |
Is anyone else currently working on this? If not I'll give it a try. |
@JacobChamberlain sure, but be prepared for some discussion as to whether this is a good idea. I tend to think it is a good idea, because those kwarg dictionaries are pretty ugly and hard for users to grok, but there may be subtleties I'm not aware of. |
@jklymak We suspect we may run into some issue. I'll let you know what issues we find, but those dictionaries are pretty ugly so any clean up is an improvement in my book. |
At the time I created this issue (seven and a half years ago),
which using subplots (then and in its current form) could become
and was not necessarily better. Since Now that it's been another seven and half years later, it probably no longer makes sense to make the advertised keyword arguments of Unless I'm misreading the conversation between @sabulikia, @QuLogic , and @tacaswell over in #16738, it seems like we should close this issue? |
I agree this should be closed. |
While working on #1458, it occurred to me that it might not be a bad idea to process the keyword arguments given to
plt.subplots
and pass them along in the appropriate direction. As I alluded to in #1458, currently, to replace lines like:fig = plt.figure(figsize=(10,20))
ax = plt.subplot(111, axisbg='w')
you have to do an awkward thing to subplot's keyword arguments, since,
subplot*s*
passes its keyword arguments to plt.figure.but, at least as I was going through our examples, all of the subplot keyword arguments were pretty unambiguously named, and could not be interpreted as figure keyword arguments. So there's no reason why we shouldn't make the next line work the same as the two examples above:
in our docs, plt.axes takes these kwargs:
and plt.subplot says it deals with
axisbg
,polar
, andprojection
The text was updated successfully, but these errors were encountered: