Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix over/under mathtext symbols#19314

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 5 commits intomatplotlib:masterfromaitikgupta:overunder-alignment
Feb 10, 2021

Conversation

aitikgupta
Copy link
Contributor

PR Summary

This PR fixes the alignment issues with the currentoverunder symbols inmathtext.

Brief summary of the proposal:

(This rewrites the following IDs of the tests):

baselines_to_rewrite= [18,22,29,34,52,67]

Closes#19178

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@aitikgupta
Copy link
ContributorAuthor

aitikgupta commentedJan 18, 2021
edited
Loading

Some tests other thanmathtext also use these symbols, for example:

lib/matplotlib/tests/test_text.py::test_multiline2:

The diff is as expected:

@anntzer
Copy link
Contributor

I am confused as to why the mathfont tests (which do not involve subsuper) have baseline changes? (perhaps I'm missing something obvious...)

@QuLogic
Copy link
Member

It looks like maybe you updatedmathfont_* when onlymathtext_* were necessary? Also, maybe 18 doesn't need an update, but it's hard to tell from the GitHub diff only.

@aitikgupta
Copy link
ContributorAuthor

aitikgupta commentedJan 19, 2021
edited
Loading

There's a good reason to believe 18 shouldn't be updated, but I think the global positioning inside svg is changing?
This is the failed diff:

(And yes, my bad, I just used the IDs of the baselines - so it includedmathtext_* andmathfont_*)
Thanks for pointing it out@anntzer@QuLogic :)

@QuLogic
Copy link
Member

Yes, I can see that 18 needs updates in some places but not all of them. Try usingtools/triage_tests.py to see what ones really need updates.

@aitikgupta
Copy link
ContributorAuthor

aitikgupta commentedJan 20, 2021
edited
Loading

some places but not all of them

That's right, and it was deliberate - for 18 only these fail (6 out of 15 variants):

18-pdf-mathtext-cm18-pdf-mathtext-dejavuserif18-pdf-mathtext-stix18-svg-mathtext-stix18-svg-mathtext-stixsans

For IDs like 22 or 67, (15 out of 15 fail):

67-pdf-mathtext-cm67-pdf-mathtext-dejavusans67-pdf-mathtext-dejavuserif67-pdf-mathtext-stix67-pdf-mathtext-stixsans67-png-mathtext-cm67-png-mathtext-dejavusans67-png-mathtext-dejavuserif67-png-mathtext-stix67-png-mathtext-stixsans67-svg-mathtext-cm67-svg-mathtext-dejavusans67-svg-mathtext-dejavuserif67-svg-mathtext-stix67-svg-mathtext-stixsans

I believe we're comparing images with a tolerance?
Which is why I thought it's better to update all variants for IDs like 18.

We could changejust the failing images and forget about the IDs, it should not raise an error. Should I update the PR?

@QuLogic
Copy link
Member

I believe we're comparing images with a tolerance?

No, the default tolerance is 0, and I don't see the mathtext tests setting anything different.

We could changejust the failing images and forget about the IDs, it should not raise an error. Should I update the PR?

Yes, better to reduce test image churn when there is no failure necessitating an update.

aitikgupta reacted with thumbs up emoji

@aitikgupta
Copy link
ContributorAuthor

aitikgupta commentedJan 20, 2021
edited
Loading

With the latest push only 67 failingmathtext images are updated, regardless of their IDs.

The failing mathtext images:
to_rewrite= ["mathtext_cm_18.pdf","mathtext_dejavuserif_18.pdf","mathtext_stix_18.pdf","mathtext_stix_18.svg","mathtext_stixsans_18.svg","mathtext_cm_22.pdf","mathtext_dejavusans_22.pdf","mathtext_dejavuserif_22.pdf","mathtext_stix_22.pdf","mathtext_stixsans_22.pdf","mathtext_cm_22.png","mathtext_dejavusans_22.png","mathtext_dejavuserif_22.png","mathtext_stix_22.png","mathtext_stixsans_22.png","mathtext_cm_22.svg","mathtext_dejavusans_22.svg","mathtext_dejavuserif_22.svg","mathtext_stix_22.svg","mathtext_stixsans_22.svg","mathtext_dejavuserif_29.pdf","mathtext_dejavusans_29.svg","mathtext_cm_34.pdf","mathtext_dejavusans_34.pdf","mathtext_dejavuserif_34.pdf","mathtext_stix_34.pdf","mathtext_stixsans_34.pdf","mathtext_cm_34.png","mathtext_dejavusans_34.png","mathtext_dejavuserif_34.png","mathtext_stix_34.png","mathtext_stixsans_34.png","mathtext_cm_34.svg","mathtext_dejavusans_34.svg","mathtext_dejavuserif_34.svg","mathtext_stix_34.svg","mathtext_stixsans_34.svg","mathtext_cm_52.pdf","mathtext_dejavusans_52.pdf","mathtext_dejavuserif_52.pdf","mathtext_stix_52.pdf","mathtext_stixsans_52.pdf","mathtext_cm_52.png","mathtext_dejavusans_52.png","mathtext_dejavuserif_52.png","mathtext_stix_52.png","mathtext_stixsans_52.png","mathtext_cm_52.svg","mathtext_dejavusans_52.svg","mathtext_dejavuserif_52.svg","mathtext_stix_52.svg","mathtext_stixsans_52.svg","mathtext_cm_67.pdf","mathtext_dejavusans_67.pdf","mathtext_dejavuserif_67.pdf","mathtext_stix_67.pdf","mathtext_stixsans_67.pdf","mathtext_cm_67.png","mathtext_dejavusans_67.png","mathtext_dejavuserif_67.png","mathtext_stix_67.png","mathtext_stixsans_67.png","mathtext_cm_67.svg","mathtext_dejavusans_67.svg","mathtext_dejavuserif_67.svg","mathtext_stix_67.svg","mathtext_stixsans_67.svg"  ]

@aitikgupta
Copy link
ContributorAuthor

aitikgupta commentedFeb 4, 2021
edited
Loading

I think this is supposed to go with the 3.4 release@QuLogic
Right@anntzer?

@QuLogic
Copy link
Member

It would need a second review.

aitikgupta reacted with thumbs up emoji

@QuLogicQuLogic added this to thev3.4.0 milestoneFeb 4, 2021
@anntzeranntzer self-assigned thisFeb 5, 2021
@anntzer
Copy link
Contributor

Just a few points regarding the baseline images changes:

  • I would just delete test 18, because the math expression is strictly included in the expression of test 22.
  • I would group the changed tests together into single expressions (resulting in a single test image), because not having to repeatedly embed the glyphs in each of the pdf/svg files results in significant savings. IOW, the following patch
diff --git i/lib/matplotlib/tests/test_mathtext.py w/lib/matplotlib/tests/test_mathtext.pyindex 16ac7c7ba..b5fd906d2 100644--- i/lib/matplotlib/tests/test_mathtext.py+++ w/lib/matplotlib/tests/test_mathtext.py@@ -31,11 +31,13 @@ math_tests = [     r'$x^2$',     r'$x^2_y$',     r'$x_y^2$',-    r'$\prod_{i=\alpha_{i+1}}^\infty$',+    (r'$\sum _{\genfrac{}{}{0}{}{0\leq i\leq m}{0<j<n}}f\left(i,j\right)'+     r'\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i \sin(2 \pi f x_i)'+     r"\sqrt[2]{\prod^\frac{x}{2\pi^2}_\infty}$"),     r'$x = \frac{x+\frac{5}{2}}{\frac{y+3}{8}}$',     r'$dz/dt = \gamma x^2 + {\rm sin}(2\pi y+\phi)$',     r'Foo: $\alpha_{i+1}^j = {\rm sin}(2\pi f_j t_i) e^{-5 t_i/\tau}$',-    r'$\mathcal{R}\prod_{i=\alpha_{i+1}}^\infty a_i \sin(2 \pi f x_i)$',+    None,     r'Variable $i$ is good',     r'$\Delta_i^j$',     r'$\Delta^j_{i+1}$',@@ -47,7 +49,7 @@ math_tests = [     r"$f'\quad f'''(x)\quad ''/\mathrm{yr}$",     r'$\frac{x_2888}{y}$',     r"$\sqrt[3]{\frac{X_2}{Y}}=5$",-    r"$\sqrt[5]{\prod^\frac{x}{2\pi^2}_\infty}$",+    None,     r"$\sqrt[3]{x}=5$",     r'$\frac{X}{\frac{X}{Y}}$',     r"$W^{3\beta}_{\delta_1 \rho_1 \sigma_2} = U^{3\beta}_{\delta_1 \rho_1} + \frac{1}{8 \pi 2} \int^{\alpha_2}_{\alpha_2} d \alpha^\prime_2 \left[\frac{ U^{2\beta}_{\delta_1 \rho_1} - \alpha^\prime_2U^{1\beta}_{\rho_1 \sigma_2} }{U^{0\beta}_{\rho_1 \sigma_2}}\right]$",@@ -89,11 +91,13 @@ math_tests = [     r'${x}_{92}^{31415}+\pi $',     r'${x}_{{y}_{b}^{a}}^{{z}_{c}^{d}}$',     r'${y}_{3}^{\prime \prime \prime }$',+    # End of the MathML torture tests.+     r"$\left( \xi \left( 1 - \xi \right) \right)$",  # Bug 2969451     r"$\left(2 \, a=b\right)$",  # Sage bug #8125     r"$? ! &$",  # github issue #466     None,-    r'$\sum _{\genfrac{}{}{0}{}{0\leq i\leq m}{0<j<n}}P\left(i,j\right)$',+    None,     r"$\left\Vert a \right\Vert \left\vert b \right\vert \left| a \right| \left\| b\right\| \Vert a \Vert \vert b \vert$",     r'$\mathring{A}  \AA$',     r'$M \, M \thinspace M \/ M \> M \: M \; M \ M \enspace M \quad M \qquad M \! M$',

(together with updating image 18 for the new test) shrinks the overall size of the new baselines from 508K to 256K, a not insignificant saving. (I explicitly left test 52 alone as we can reasonably leave the "mathml torture test" as is; I also slightly tweaked the mathtext expression to reduce the number of independent glyphs used.)

aitikgupta reacted with thumbs up emoji

@aitikgupta
Copy link
ContributorAuthor

I notice something interesting:
Following two arepng andsvg outputs of test 52dejavusans font.
Note how theb character is shifted, as well as the bottomi, j, k characters in thepng vssvg output.

image
image

(side by side)

Maybe it's hard to notice here, but there is definitely something fishy w.r.t. png vs svg backend?

@anntzer
Copy link
Contributor

anntzer commentedFeb 7, 2021
edited
Loading

Without looking carefully at this, it may be related to#19261 (comment) /#5414? (If so, this may change depending onrcParams["text.hinting"].)

aitikgupta reacted with thumbs up emoji

@QuLogic
Copy link
Member

You will need to rebase if you want to fix the docs CI build.@anntzer is there anything else left to do here?

@anntzer
Copy link
Contributor

anntzer commentedFeb 9, 2021
edited
Loading

Nope, lgtm.
@QuLogic did you want docs to build?

@QuLogic
Copy link
Member

No, it doesn't look like this has any relevant doc changes.

@QuLogicQuLogic merged commit8ff6e8a intomatplotlib:masterFeb 10, 2021
@aitikguptaaitikgupta deleted the overunder-alignment branchFebruary 10, 2021 06:04
tacaswell added a commit to tacaswell/matplotlib that referenced this pull requestJun 15, 2023
b0dbead viamatplotlib#19314 several testswere merged but the images for them were not removed.
devRD pushed a commit to devRD/matplotlib that referenced this pull requestJun 19, 2023
b0dbead viamatplotlib#19314 several testswere merged but the images for them were not removed.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@anntzeranntzeranntzer approved these changes

Assignees

@anntzeranntzer

Projects
None yet
Milestone
v3.4.0
Development

Successfully merging this pull request may close these issues.

mathtext \lim is vertically misaligned
3 participants
@aitikgupta@anntzer@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp