8000 FIX: make EngFormatter respect axes.unicode_minus rcParam by pharshalp · Pull Request #13477 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: make EngFormatter respect axes.unicode_minus rcParam #13477

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 5 commits into from
Mar 3, 2019
Merged

FIX: make EngFormatter respect axes.unicode_minus rcParam #13477

merged 5 commits into from
Mar 3, 2019

Conversation

pharshalp
Copy link
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)

test

Example (New behavior)

test_new

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 tacaswell added this to the v3.2.0 milestone Feb 21, 2019
@anntzer
Copy link
Contributor
anntzer commented Feb 21, 2019

the test failures are real

@pharshalp pharshalp changed the title FIX: make EngFormatter respect axes.unicode_minus rcParam [WIP] FIX: make EngFormatter respect axes.unicode_minus rcParam Feb 21, 2019
@pharshalp
Copy link
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 pharshalp changed the title [WIP] FIX: make EngFormatter respect axes.unicode_minus rcParam FIX: make EngFormatter respect axes.unicode_minus rcParam Feb 24, 2019
@pharshalp
Copy link
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
Copy link
Contributor
anntzer commented Feb 25, 2019

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.

@pharshalp
Copy link
Contributor Author

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

Copy link
Contributor
@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

modulo ci

@timhoffm timhoffm modified the milestones: v3.2.0, v3.1.0 Mar 3, 2019
@timhoffm
Copy link
Member
timhoffm commented Mar 3, 2019

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

@timhoffm timhoffm merged commit aed13c1 8000 into matplotlib:master Mar 3, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 3, 2019
@pharshalp
Copy link
Contributor Author

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

@pharshalp 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 pharshalp restored the EngFixMinus branch April 29, 2019 01:43
@pharshalp pharshalp deleted the EngFixMinus branch January 27, 2020 17:05
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
0