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 — [Bug]: test_backend_pgf.py::test_rcupdate fails with texlive 2025 · Issue #29790 · matplotlib/matplotlib

[Bug]: test_backend_pgf.py::test_rcupdate fails with texlive 2025 #29790

New issue
Copy link
New issue
Copy link
Open
Open
[Bug]: test_backend_pgf.py::test_rcupdate fails with texlive 2025#29790
Copy link
Labels
topic: text/usetex

Description

@MeggyCal
MeggyCal
opened on Mar 21, 2025
Issue body actions

Bug summary

Hi all, thanks for this useful library! Sadly, with texlive 20250308 test_backend_pgf.py::test_rcupdate image comparison fails in matplotlib 3.10.1. I don't have the images, as the tests ran on an external system.

Code for reproduction

run `test_backend_pgf.py::test_rcupdate`

Actual outcome

I am sorry, as I said, I don't have the images and the log is boring otherwise:

[  503s] ________________________________ test_rcupdate _________________________________
[  503s] 
[  503s]     @needs_pgf_xelatex
[  503s]     @needs_pgf_pdflatex
[  503s]     @mpl.style.context('default')
[  503s]     @pytest.mark.backend('pgf')
[  503s]     def test_rcupdate():
[  503s]         rc_sets = [{'font.family': 'sans-serif',
[  503s]                     'font.size': 30,
[  503s]                     'figure.subplot.left': .2,
[  503s]                     'lines.markersize': 10,
[  503s]                     'pgf.rcfonts': False,
[  503s]                     'pgf.texsystem': 'xelatex'},
[  503s]                    {'font.family': 'monospace',
[  503s]                     'font.size': 10,
[  503s]                     'figure.subplot.left': .1,
[  503s]                     'lines.markersize': 20,
[  503s]                     'pgf.rcfonts': False,
[  503s]                     'pgf.texsystem': 'pdflatex',
[  503s]                     'pgf.preamble': ('\\usepackage[utf8x]{inputenc}'
[  503s]                                      '\\usepackage[T1]{fontenc}'
[  503s]                                      '\\usepackage{sfmath}')}]
[  503s]         tol = [0, 13.2] if _old_gs_version else [0, 0]
[  503s]         for i, rc_set in enumerate(rc_sets):
[  503s]             with mpl.rc_context(rc_set):
[  503s]                 for substring, pkg in [('sfmath', 'sfmath'), ('utf8x', 'ucs')]:
[  503s]                     if (substring in mpl.rcParams['pgf.preamble']
[  503s]                             and not _has_tex_package(pkg)):
[  503s]                         pytest.skip(f'needs {pkg}.sty')
[  503s]                 create_figure()
[  503s] >               compare_figure(f'pgf_rcupdate{i + 1}.pdf', tol=tol[i])
[  503s] 
[  503s] /usr/lib64/python3.11/site-packages/matplotlib/tests/test_backend_pgf.py:142: 
[  503s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  503s] 
[  503s] fname = 'pgf_rcupdate2.pdf', savefig_kwargs = {}, tol = 0
[  503s] 
[  503s]     def compare_figure(fname, savefig_kwargs={}, tol=0):
[  503s]         actual = os.path.join(result_dir, fname)
[  503s]         plt.savefig(actual, **savefig_kwargs)
[  503s]     
[  503s]         expected = os.path.join(result_dir, "expected_%s" % fname)
[  503s]         shutil.copyfile(os.path.join(baseline_dir, fname), expected)
[  503s]         err = compare_images(expected, actual, tol=tol)
[  503s]         if err:
[  503s] >           raise ImageComparisonFailure(err)
[  503s] E           matplotlib.testing.exceptions.ImageComparisonFailure: Error: Image files did not match.
[  503s] E             RMS Value: 4.23523981360686
[  503s] E             Expected:  
[  503s] E               /home/abuild/rpmbuild/BUILD/python-matplotlib-test-3.10.1-build/matplotlib-3.10.1/result_images/test_backend_pgf/expected_pgf_rcupdate2_pdf.png
[  503s] E             Actual:    
[  503s] E               /home/abuild/rpmbuild/BUILD/python-matplotlib-test-3.10.1-build/matplotlib-3.10.1/result_images/test_backend_pgf/pgf_rcupdate2_pdf.png
[  503s] E             Difference:
[  503s] E               /home/abuild/rpmbuild/BUILD/python-matplotlib-test-3.10.1-build/matplotlib-3.10.1/result_images/test_backend_pgf/pgf_rcupdate2_pdf-failed-diff.png
[  503s] E             Tolerance: 
[  503s] E               0
[  503s] 
[  503s] /usr/lib64/python3.11/site-packages/matplotlib/tests/test_backend_pgf.py:34: ImageComparisonFailure

Expected outcome

tests pass

Additional information

No response

Operating system

openSUSE Tumbleweed

Matplotlib Version

3.10.1

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

from source (.tar.gz)

Activity

  1. dstansby
    added
    topic: text/usetex
    on Mar 25, 2025
  2. anupamdwivedi98 commented on Mar 3, 2026

    @anupamdwivedi98
    anupamdwivedi98
    on Mar 3, 2026
    More actions

    Hi! I would like to investigate this issue.

    Since this is an image comparison failure with texlive 2025, I suspect that the PDF rendering output may have slightly changed compared to the existing baseline images.

    I will try to reproduce this locally with texlive 2025 and determine whether this requires updating the baseline images or adjusting the PGF backend.

    I’ll report back with my findings before opening a PR.

    Reacted by Tim Hoffmann
  3. axel-j-larsson commented on Sep 28, 2026

    @axel-j-larsson
    axel-j-larsson
    on Sep 28, 2026
    More actions

    Hi, I also came across this issue when running the tests and would like to look into it.

    The test output images appear to show a small difference around the 'h' character in "math":

    Expected pgf_rcupdate_2_pdf Actual pgf_rcupdate_2_pdf Diff

    I ran the test using both texlive 2024 and texlive 2025, and the test only fails when using the latter.
    For now, I will try to investigate what is causing the difference, and I'll report back with my findings.

  4. axel-j-larsson commented on Oct 8, 2026

    @axel-j-larsson
    axel-j-larsson
    on Oct 8, 2026
    More actions

    I believe I have found the cause of the failure.

    As mentioned, the test passes with texlive 2024 but fails with texlive 2025. I checked whether the difference was coming from Matplotlib itself or from some part of the TeX/PDF rendering pipeline.

    I captured the .pgf and .tex files that were generated by backend_pgf.py and compiled the same input manually using both texlive 2024 and 2025. What I found was that the different pdfTeX versions produced small differences in the PDF content. I also checked the Ghostscript rasterization, and that reproduced the same images as the ones generated from the test.

    In conclusion, the rendering difference appears to be introduced by changes in pdfTeX between the two texlive versions rather than by the PGF output generated by Matplotlib.

    @timhoffm I also tried using the texlive 2025 output as the new baseline image. This makes the test pass for texlive 2025 but then causes it to fail for texlive 2024 instead. As such, I was wondering whether the preferred solution is to update the baseline or leave it as is.

    If updating the baseline to the texlive 2025 rendering is preferred, I'd be happy to prepare a PR with the updated image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: text/usetex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — 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.