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

Correctly read the 'style' argument while processing 'genfrac'.#23034

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
oscargus merged 7 commits intomatplotlib:mainfromtfpf:genfrac-style
Jun 16, 2022

Conversation

tfpf
Copy link
Contributor

@tfpftfpf commentedMay 11, 2022
edited
Loading

PR Summary

An attempt tofix#23008.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

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

@tfpftfpf marked this pull request as ready for reviewMay 12, 2022 08:40
@tfpf
Copy link
ContributorAuthor

Thought I'd try one more thing beforeIntEnum. Automatically converting the style code into anenum by makingstyle_literal a separate function seems to be a better approach? (It solves the double conversion problem, too.)

@anntzer
Copy link
Contributor

Sure, that works too.

@tfpf
Copy link
ContributorAuthor

Some backend tests have failed—I don't suppose they are related to these changes? (I remember that they had passed after commitb7dee27.)

@anntzer
Copy link
Contributor

Indeed, these are irrelevant.
Probably this could use a test using check_figures_equal comparing genfrac and dfrac?

@tfpf
Copy link
ContributorAuthor

Yes, I could add a test for that. One point, though:\genfrac needsrulesize, which only accepts floating-point numbers, whereas\dfrac uses a rule size ofself.get_state().get_current_underline_thickness(). Not sure how to proceed.

If I set the rule size to 1 (e.g.\genfrac{}{}{1}{0}{2x}{3y} compared with\dfrac{2x}{3y}), the test passes (it fails for 0 and 2). But that doesn't look like agood test?

@tfpf
Copy link
ContributorAuthor

One point, though:\genfrac needsrulesize, which only accepts floating-point numbers, whereas\dfrac uses a rule size ofself.get_state().get_current_underline_thickness().

I am open to suggestions!

@anntzer
Copy link
Contributor

I agree this is a bit annoying :( Probably I would cheat a bit and, in the test, use

thickness = matplotlib._mathtext.TruetypeFonts.get_underline_thickness(None, None, fontsize=<whatever>, dpi=<whatever>)

and insert that value into the test genfrac.

Copy link
Contributor

@anntzeranntzer left a comment

Choose a reason for hiding this comment

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

Minor nits, which don't prevent the approval IMO.

@tfpf
Copy link
ContributorAuthor

Rebased on the currentmain branch, since a temporary fix for the failing macOS tests appears to be in place.

@tfpftfpf marked this pull request as draftJune 16, 2022 07:51
@tfpf
Copy link
ContributorAuthor

Fixed merge conflicts and rebased again. There are a couple of back-and-forth changes, so I will combine everything into a single commit.

The test failures are due to an unidentified image error. Not sure what went wrong.

@tfpftfpf marked this pull request as ready for reviewJune 16, 2022 11:05
@oscargusoscargus merged commit4acd3be intomatplotlib:mainJun 16, 2022
@oscargus
Copy link
Member

I squashed the commit. Thanks!

tfpf reacted with hooray emoji

@tfpftfpf deleted the genfrac-style branchJune 16, 2022 15:43
oscargus pushed a commit to oscargus/matplotlib that referenced this pull requestJun 18, 2022
…lotlib#23034)* Correctly read the 'style' argument while processing 'genfrac'.* Default to text style if style not specified.* Hard-coded enumerations. Support script_stype and script_script_style.* Automatically convert style number to enumerated type.* Used double quotes for strings.* Verify that genfrac's displaystyle == dfrac.* Use rcParams instead of rcParamsDefault in the test.The test changes the DPI of the figure, but compares images after saving them, so rcParams['savefig.dpi'] is more appropriate.
@QuLogicQuLogic added this to thev3.6.0 milestoneJun 21, 2022
jklymak pushed a commit to jklymak/matplotlib that referenced this pull requestJun 24, 2022
…lotlib#23034)* Correctly read the 'style' argument while processing 'genfrac'.* Default to text style if style not specified.* Hard-coded enumerations. Support script_stype and script_script_style.* Automatically convert style number to enumerated type.* Used double quotes for strings.* Verify that genfrac's displaystyle == dfrac.* Use rcParams instead of rcParamsDefault in the test.The test changes the DPI of the figure, but compares images after saving them, so rcParams['savefig.dpi'] is more appropriate.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@anntzeranntzeranntzer approved these changes

@oscargusoscargusoscargus approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.6.0
Development

Successfully merging this pull request may close these issues.

[ENH]: Use\genfrac in display style?
4 participants
@tfpf@anntzer@oscargus@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp