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

Use facecolor with axes #21

Merged
merged 2 commits into from
Dec 7, 2017
Merged

Use facecolor with axes #21

merged 2 commits into from
Dec 7, 2017

Conversation

jakirkham
Copy link
Owner

Apparently the Axes attribute, axisbg, is being deprecated. This switches over to using the suggested facecolor instead.

@jakirkham
Copy link
Owner Author

Appears this feature is only present in matplotlib 2. Hence the CI failure. So if we switch to it, we can't go back to matplotlib 1. It seems unlikely we will need to. Still can't see a good reason to break support with matplotlib 1 yet. For now will hold off on this change as matplotlib 2 seems to still support the deprecated behavior.

@jakirkham jakirkham force-pushed the use_axes_facecolor branch 2 times, most recently from c2b736b to 7be2e72 Compare December 7, 2017 03:48
@jakirkham jakirkham force-pushed the use_axes_facecolor branch 2 times, most recently from 21178d6 to 2789e75 Compare December 7, 2017 04:06
@jakirkham
Copy link
Owner Author

Added a version check to determine whether matplotlib 1 or matplotlib 2 behavior should be used.

@jakirkham
Copy link
Owner Author

Added a version check to choose between using the old axisbg and the new facecolor. Based on a quick test, this eliminates the warning on matplotlib 2 without breaking matplotlib 1. There is no test added here, but the issue is a minor warning. So is not of major concern. Just would be nice to avoid the warning when possible, which this seems to do.

Uses `facecolor` with `axes` on Matplotlib 2+. On older versions of
Matplotlib (e.g. 1), fallback to using `axisbg` instead.
mpl_2_ver = distutils.version.LooseVersion("2")

fig_axes_kwargs = {}
axcolor_name = "facecolor" if mpl_ver >= mpl_2_ver else "axisbg"
Copy link
Owner Author

Choose a reason for hiding this comment

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

Checked that this works correctly for dev releases as well. Though it is not really relevant any more.

@jakirkham jakirkham merged commit e1583d5 into master Dec 7, 2017
@jakirkham jakirkham deleted the use_axes_facecolor branch December 7, 2017 04:30
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.

None yet

1 participant