FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

FIX: make EngFormatter respect axes.unicode_minus rcParam by pharshalp · Pull Request #13477 · matplotlib/matplotlib · GitHub

FIX: make EngFormatter respect axes.unicode_minus rcParam - #13477

Merged
timhoffm merged 5 commits into
matplotlib:masterfrom
pharshalp:EngFixMinus
Mar 3, 2019
Merged

timhoffm merged 5 commits into
matplotlib:masterfrom
pharshalp:EngFixMinus

Conversation

Copy link
Copy Markdown
Contributor

PR Summary

EngFormatter was not respecting the axes.unicode_minus rcParam.

Example (old behavior)

import matplotlib.pyplot as plt
from matplotlib.ticker import EngFormatter
plt.rc('font', size=14)
fig, ax = plt.subplots(figsize=(4.0, 2.5), constrained_layout=True)
ax.plot([-10000, -5000, 0, 5000, 10000], [-10000, -5000, 0, 5000, 10000], '*-')
formatter = EngFormatter()
ax.xaxis.set_major_formatter(formatter)
ax.yaxis.set_major_formatter(formatter)
fig.savefig('old_EngFormatter.png', dpi=200)

Example (New behavior)

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 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

tacaswell added this to the v3.2.0 milestone Feb 21, 2019
Comment thread lib/matplotlib/ticker.py

anntzer commented Feb 21, 2019

Copy link
Copy Markdown
Contributor

the test failures are real

pharshalp changed the title FIX: make EngFormatter respect axes.unicode_minus rcParam [WIP] FIX: make EngFormatter respect axes.unicode_minus rcParam Feb 21, 2019

Copy link
Copy Markdown
Contributor Author

working on updating the failing tests to ensure both cases (with and without unicode minus) are checked (current tests don't include unicode minus).

pharshalp changed the title [WIP] FIX: make EngFormatter respect axes.unicode_minus rcParam FIX: make EngFormatter respect axes.unicode_minus rcParam Feb 24, 2019

Copy link
Copy Markdown
Contributor Author

Updated the test to make it pass. Should I be checking for the non-default value of the rcParam axes.unicode_minus=False? The current test assumes the default value of the rcParam axes.unicode_minus=True.

anntzer commented Feb 25, 2019

Copy link
Copy Markdown
Contributor

rcparams are always reset to their defaults before running the tests.

I guess adding a test that things work as expected when the rcParam is changed before creating the formatter would be nice, but not compulsory.

Copy link
Copy Markdown
Contributor Author

Updated the test to check for the non-default value of axes.unicode_minus rcParam. I think this is ready for review.

Comment thread lib/matplotlib/tests/test_ticker.py Outdated

anntzer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

modulo ci

timhoffm modified the milestones: v3.2.0, v3.1.0 Mar 3, 2019

timhoffm commented Mar 3, 2019

Copy link
Copy Markdown
Member

Remilestoning to 3.1. It's good to get this in.

timhoffm merged commit aed13c1 into matplotlib:master Mar 3, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 3, 2019

Copy link
Copy Markdown
Contributor Author

Thanks! I was going to request that. I wasn't sure about the workload on core developers so was hesitant.

pharshalp deleted the EngFixMinus branch March 3, 2019 21:32
QuLogic added a commit that referenced this pull request Mar 3, 2019
…477-on-v3.1.x

Backport PR #13477 on branch v3.1.x (FIX: make EngFormatter respect axes.unicode_minus rcParam)
pharshalp restored the EngFixMinus branch April 29, 2019 01:43
pharshalp deleted the EngFixMinus branch January 27, 2020 17:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

5 participants


Back | FazBrowse Home | New Git URL