GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ENH: Add option to relpace text with boxes in image_comparision test by timhoffm · Pull Request #29871 · matplotlib/matplotlib

Conversation

@timhoffm

@timhoffm timhoffm commented Apr 5, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This should be the right level of simplification when text is relevant in image comparision tests but the exact characters do not matter. The drawn bboxes only rely on font metrics and thus give accurate sizes, while being insensitive to rendering details.

Alternative to #29833.

This is a minimal proof-of-concept. Exact implementation may be improved:

  • How should boxes be rendered? Is one or the other better in terms of png compression?
    • only outline with transparent face (current choice)
    • fully filled?
  • Is a true/false flag sufficient or should this be configurable?
    • styling options
    • option to draw text and box (possibly mainly good for debug purposes)
  • for a start, the global replacement at draw time should be sufficident. One could refine for selective replacement if needed later.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@timhoffm
ENH: Add option to relpace text with boxes in image_comparision test
14a2b55
This should be the right level of simplification when text is relevant
in image comparision tests but the exact characters do not matter. The
drawn bboxes only rely on font metrics and thus give accurate sizes,
while being insensitive to rendering details.

This is a minimal proof-of-concept. Exact implementation may be improved
.
@github-actions github-actions Bot added the topic: text label Apr 5, 2025
@QuLogic

QuLogic commented Apr 5, 2025

Copy link
Copy Markdown
Member

Looks like we crossed with #29872.

The drawn bboxes only rely on font metrics and thus give accurate sizes, while being insensitive to rendering details.

Unfortunately, relying on font metrics is not safe to avoid changes in test images. For example, if you change the hinting settings in matplotlib.testing.set_font_settings_for_testing (one of the things I want to do in #29816), then the tests here fail.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@timhoffm timhoffm mentioned this pull request Apr 5, 2025
Update FreeType to 2.13.3 #29816
Merged
5 tasks
@timhoffm

timhoffm commented Apr 5, 2025

Copy link
Copy Markdown
Member Author

Superseeded by #29872.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@timhoffm timhoffm closed this Apr 5, 2025
@timhoffm timhoffm reopened this Apr 5, 2025
@timhoffm
timhoffm requested a review from Copilot April 5, 2025 09:23
Copilot AI reviewed Apr 5, 2025
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/matplotlib/text.py
"""
A helper flag to replace texts by a bounding box. This is primarily
intended for use in figure comparison tests.
For sipmlicity, the flag is evaluated at draw time and thus applies

Copilot AI Apr 5, 2025

Copy link

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

There is a spelling error in the word 'sipmlicity'; consider correcting it to 'simplicity'.

Suggested change
For sipmlicity, the flag is evaluated at draw time and thus applies
For simplicity, the flag is evaluated at draw time and thus applies

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot uses AI. Check for mistakes.

@timhoffm timhoffm Apr 5, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ok, just wanted to try what copilot review suggested.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rcomer reacted with eyes emoji
All reactions
  • 👀 1 reaction

@QuLogic QuLogic Apr 5, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It didn't even manage to catch the typos in the PR title...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rcomer reacted with laugh emoji
All reactions
  • 😄 1 reaction
@timhoffm timhoffm closed this Apr 5, 2025
@timhoffm
timhoffm deleted the image-comparison-text-box branch April 5, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@QuLogic QuLogic QuLogic left review comments
Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic: text

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@timhoffm @QuLogic
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.