Skip to content

Fixed decimal points not appearing at end of Mathtext string. #23357

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
Jun 29, 2022

Conversation

tfpf
Copy link
Contributor

@tfpf tfpf commented Jun 28, 2022

PR Summary

Numeric strings ending with a decimal point are rendered without the decimal point by Mathtext.

import matplotlib.pyplot as plt
# plt.rcdefaults()
plt.text(.4, .4, '$123.$', usetex=True)
plt.text(.6, .4, '$abc.$', usetex=True)
plt.text(.4, .6, '$123.$', usetex=False)
plt.text(.6, .6, '$abc.$', usetex=False)
plt.show()

Before:
no_decimal_point

After:
yes_decimal_point

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).

@tfpf tfpf marked this pull request as ready for review June 28, 2022 09:36
@QuLogic QuLogic added this to the v3.6.0 milestone Jun 28, 2022
@QuLogic
Copy link
Member

QuLogic commented Jun 28, 2022

Can we update/add a test for this?

@tfpf
Copy link
Contributor Author

tfpf commented Jun 29, 2022

I put the test in lightweight_math_tests, since this isn't a font-specific problem, and isn't related to the alignment of glyphs, either. Also put in some non-numeric strings for good measure.

@oscargus oscargus merged commit 17de827 into matplotlib:main Jun 29, 2022
@tfpf tfpf deleted the decimal-point-missing branch June 29, 2022 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants