8000 Use fix_minus in format_data_short. by anntzer · Pull Request #14949 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Use fix_minus in format_data_short. #14949

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 1 commit into from
Oct 1, 2019
Merged

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Jul 31, 2019

See changelog. AFAICS, all GUI toolkits (at least qt5/gtk3/wx/tk)
display the unicode minus properly.

before:
old

after:
new

(compare the minus in "x=-...")

Moving the implementation of the replacement to the base Formatter class
is because it is otherwise confusing as to whether self.fix_minus
does the replacement or not -- one needs to check whether the current
class overrides the do-nothing fix_minus. Instead, one can just have a
base-class implementation that performs the replacement, and not call
self.fix_minus if the replacement is not desired.

For example, LogFormatter.fix_minus used to do nothing; there are tests
that check that. Just don't call fix_minus instead.

PR Summary

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.3.0 milestone Aug 12, 2019
@NelleV
Copy link
Member
NelleV commented Sep 3, 2019

This is missing a unit test.

@anntzer anntzer force-pushed the fix_minus branch 2 times, most recently from 6a76383 to 93e0084 Compare September 3, 2019 19:51
@anntzer
Copy link
Contributor Author
anntzer commented Sep 4, 2019

Some of this is already tested by TestEngFormatter.test_params. There are no tests specifically for ScalarFormatter.format_data_short, but this PR doesn't change that situation.

@NelleV
Copy link
Member
NelleV commented Sep 5, 2019

You should test the behavior that has changed in this PR. Else, there is no way to check that we will not revert to the old behavior.

See changelog.  AFAICS, all GUI toolkits (at least qt5/gtk3/wx/tk)
display the unicode minus properly.

Moving the implementation of the replacement to the base Formatter class
is because it is otherwise confusing as to whether `self.fix_minus`
does the replacement or not -- one needs to check whether the current
class overrides the do-nothing fix_minus.  Instead, one can just have a
base-class implementation that performs the replacement, and not call
`self.fix_minus` if the replacement is not desired.

For example, LogFormatter.fix_minus used to do nothing; there are tests
that check that.  Just don't call fix_minus instead.
@anntzer
Copy link
Contributor Author
anntzer commented Sep 5, 2019

Sure.
I intentionally did not test the behavior with text.latex.unicode because that rcParam is deprecated and I plan to remove it before 3.3 is released anyways.

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