Skip to content

TST: Set tests touched by text overhaul to mpl20 style#31300

Merged
QuLogic merged 2 commits intomatplotlib:text-overhaulfrom
QuLogic:text-test-style
Apr 7, 2026
Merged

TST: Set tests touched by text overhaul to mpl20 style#31300
QuLogic merged 2 commits intomatplotlib:text-overhaulfrom
QuLogic:text-test-style

Conversation

@QuLogic
Copy link
Copy Markdown
Member

@QuLogic QuLogic commented Mar 13, 2026

PR summary

This is based on several other PRs to make it easier for me to track what needs changing. I will rebase those extra commits out once ready.

The first commit changes all related tests to mpl20, while the second commit changes a few so that they better work in the new style (e.g., moves a transparent legend over top something so that you can actually confirm that it's transparent.) I do expect to squash these together, but kept them separate so that it'd be easier to review the secondary changes.

AI Disclosure

None

PR checklist

@QuLogic QuLogic force-pushed the text-test-style branch 4 times, most recently from 1403060 to c0ccc2f Compare March 14, 2026 02:23
@QuLogic QuLogic marked this pull request as ready for review April 3, 2026 01:50
@QuLogic QuLogic moved this from Waiting for other PR to Ready for Review in Font and text overhaul Apr 3, 2026
@QuLogic
Copy link
Copy Markdown
Member Author

QuLogic commented Apr 3, 2026

This is now all set, except that the following tests fail on macOS only:

FAILED lib/matplotlib/tests/test_axes.py::test_canonical[png] - matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.028):
	result_images/test_axes/canonical.png
	result_images/test_axes/canonical-expected.png
	result_images/test_axes/canonical-failed-diff.png
FAILED lib/matplotlib/tests/test_axes.py::test_set_get_ticklabels[png] - matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.029):
	result_images/test_axes/set_get_ticklabels.png
	result_images/test_axes/set_get_ticklabels-expected.png
	result_images/test_axes/set_get_ticklabels-failed-diff.png
FAILED lib/matplotlib/tests/test_figure.py::test_figure[png] - matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.021):
	result_images/test_figure/figure_today.png
	result_images/test_figure/figure_today-expected.png
	result_images/test_figure/figure_today-failed-diff.png
FAILED lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py::test_zooming_with_inverted_axes[png] - matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.022):
	result_images/test_axes_grid1/zoomed_axes.png
	result_images/test_axes_grid1/zoomed_axes-expected.png
	result_images/test_axes_grid1/zoomed_axes-failed-diff.png
FAILED lib/matplotlib/tests/test_legend.py::test_labels_first[png] - matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.014):
	result_images/test_legend/legend_labels_first.png
	result_images/test_legend/legend_labels_first-expected.png
	result_images/test_legend/legend_labels_first-failed-diff.png
FAILED lib/matplotlib/tests/test_legend.py::test_multiple_keys[png] - matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.032):
	result_images/test_legend/legend_multiple_keys.png
	result_images/test_legend/legend_multiple_keys-expected.png
	result_images/test_legend/legend_multiple_keys-failed-diff.png

I am extremely surprised by the first one, as that's about the simplest plot there is.

@QuLogic
Copy link
Copy Markdown
Member Author

QuLogic commented Apr 3, 2026

Using our standard diff, it is basically invisible, but using imagemagick, the diff is:
foo
I do not understand how that could be so much for such a simple plot.

@tacaswell
Copy link
Copy Markdown
Member

Also odd that the mises are not uniform across the line.

@tacaswell
Copy link
Copy Markdown
Member

@ksunden Looked into this and they all already have tolerances and changing the style changes amount of tolerance we needs. Lets merge this and deal with the tolerances in the other PR.

Rough theory as to the distribution: we are seeing accumulated errors as a function of distance across the axis so the diagonal line is sampling different parts of that at different heights.

@ksunden
Copy link
Copy Markdown
Member

ksunden commented Apr 3, 2026

Specifically, all of these tests already had tolerances from the old style, the RMS just got higher than we had encoded.

This is due to a number of factors, likely

  • Fewer pixels in total (so changed pixels are a higher proportion)
  • Thicker lines
  • More color channels because the old tests were pure #0000FF blue

All of these tests are plotting some form of y=x+C lines (e.g. ax.plot([1,2,3]) or ax.plot(np.arange(5), etc) so it is really only that one particular line that needs this adjustment, just frustrating that it is such a simple and common case...

@QuLogic
Copy link
Copy Markdown
Member Author

QuLogic commented Apr 6, 2026

🤦‍♂️ I was looking at this from the reset-tolerances branch, and thus was confused because I thought all of these tests already had zero tolerance. Of course, if they all had one and it's just a tiny bit more now, that's quite alright.

@QuLogic QuLogic merged commit 41c4d8d into matplotlib:text-overhaul Apr 7, 2026
47 of 49 checks passed
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Font and text overhaul Apr 7, 2026
@QuLogic QuLogic deleted the text-test-style branch April 7, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants