🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@tfpf
Copy link
Contributor

@tfpf tfpf commented Aug 22, 2022

PR Summary

Fixes #10029.

import matplotlib.pyplot as plt
plt.rcdefaults()
plt.rc('font', family=['cmr10'])
plt.rc('mathtext', fontset='cm')
plt.rc('axes.formatter', use_mathtext=True)
plt.semilogy([-0.03, 0.05], [0.3, 0.05])
plt.show()

CM_multiplication_symbol

I felt that having all glyph fixes in the same place would result in cleaner code. This will also be easy to extend if, in the future, we plan to add more glyph substitutions.

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).

Copy link
Member

@oscargus oscargus left a comment

Choose a reason for hiding this comment

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

One may consider a test. but I cannot really tell what would be the simplest test as a normal text with `\times' does already work.

@tfpf
Copy link
Contributor Author

tfpf commented Aug 22, 2022

I think testing this isn't straightforward, since the missing multiplication sign logs a warning, but doesn't raise a user warning. (Otherwise, something similar to #20235 could be used to detect it.)

One thing I missed: cmr10_cmsy10_substitutions should probably be private; the way it is used seems to be an implementation detail.

@anntzer
Copy link
Contributor

anntzer commented Aug 22, 2022

Perhaps https://docs.pytest.org/en/7.1.x/how-to/logging.html#caplog-fixture can help.

@oscargus
Copy link
Member

I was more thinking about testing that the multiplication sign shows up (instead of ¤), rather than the warning thing.

@tfpf tfpf force-pushed the cmr10_cmsy10_substitutions branch from ba3891d to 077ea7c Compare August 22, 2022 16:35
@tfpf
Copy link
Contributor Author

tfpf commented Aug 22, 2022

I was more thinking about testing that the multiplication sign shows up (instead of ¤), rather than the warning thing.

I think this would require an image comparison test? I could add it if required.

@tfpf
Copy link
Contributor Author

tfpf commented Aug 23, 2022

Strange. How did the code coverage decrease. There are no uncovered lines reported in the diff.

@oscargus
Copy link
Member

I do not really understand how that test works, but it does fail from time to time, so no worries about it. (Except for maybe people not reviewing as the build "fails" anyway...)

@oscargus oscargus added this to the v3.7.0 milestone Aug 30, 2022
@tfpf tfpf force-pushed the cmr10_cmsy10_substitutions branch from 48192cc to f53301d Compare October 4, 2022 18:11
@timhoffm timhoffm merged commit 7f758c6 into matplotlib:main Oct 6, 2022
@tfpf tfpf deleted the cmr10_cmsy10_substitutions branch October 6, 2022 16:03
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.

\times in minor ticklabels not recognized due to \mathdefault

4 participants