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

Skip to content

FIX: subplots don't mutate kwargs passed by user. #11601

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

Merged
merged 2 commits into from
Jul 9, 2018

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Jul 8, 2018

PR Summary

Closes #11515

Don't mess with the user-supplied dictionaries in subplots...

Dunno if this really merits a test..

import numpy as np
import matplotlib.pyplot as plt


subplot_kw = {'sharex': 'all'}
print(subplot_kw)
fig, ax = plt.subplots(2, 1, subplot_kw=subplot_kw)
print(subplot_kw)

New:

{'sharex': 'all'}
{'sharex': 'all'}

Old:

{'sharex': 'all'}
{'sharex': None, 'sharey': None}

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@jklymak jklymak added this to the v3.1 milestone Jul 8, 2018
Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be worth putting the test in.

@jklymak
Copy link
Member Author

jklymak commented Jul 9, 2018

Test added per suggestion @dstansby

@timhoffm timhoffm merged commit 27493dc into matplotlib:master Jul 9, 2018
@jklymak jklymak deleted the fix-dont-mutate branch July 9, 2018 19:23
@QuLogic QuLogic modified the milestones: v3.1, v3.0 Jul 9, 2018
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

Successfully merging this pull request may close these issues.

using 'sharex' once in 'subplots' function can affect subsequent calles to 'subplots'
4 participants