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 SVG rendering error in def update_background#30490

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
tacaswell merged 4 commits intomatplotlib:mainfromAasmaGupta:fix-svg-error
Sep 2, 2025

Conversation

@AasmaGupta
Copy link
Contributor

@AasmaGuptaAasmaGupta commentedAug 29, 2025
edited
Loading

Reference issue (if any)

Example: AttributeError: 'FigureCanvasSVG' object has no attribute 'copy_from_bbox'

Fixes#30485

  • Why is this change necessary?
    Saving figures as SVG could crash due to the waydef update_background handled blitting in thelib/matplotlib/widgets.py file. This change prevents that crash.

  • What problem does it solve?
    fixes the crash that occurred specifically when exporting plots to SVG format

  • What is the reasoning for this implementation?
    Blitting is meant for interactive updates and isn’t needed when saving static outputs. Skipping it during SVG export prevents the crash while keeping normal interactive behavior intact.

PR checklist

@AasmaGupta
Copy link
ContributorAuthor

i tested the fix using the code below which reproduces the issue and confirms that SVG export no longer crashes:

import numpy as npimport matplotlibmatplotlib.use("Agg")  import matplotlib.pyplot as pltfrom matplotlib.widgets import SpanSelectorfig, ax = plt.subplots()ax.plot(np.random.randn(100, 3))ax._span = SpanSelector(ax, lambda xmin, xmax: None, "horizontal", useblit=True)fig.savefig("test.svg")print("Saved successfully without crash!")

@QuLogic
Copy link
Member

There is no such thing as_setup_plot_projector in Matplotlib; what is this actually about?

@AasmaGuptaAasmaGupta changed the titleFix SVG rendering error in _setup_plot_projectorFix SVG rendering error in def update_backgroudAug 30, 2025
@AasmaGuptaAasmaGupta changed the titleFix SVG rendering error in def update_backgroudFix SVG rendering error in def update_backgroundAug 30, 2025
@AasmaGupta
Copy link
ContributorAuthor

I have updated the PR with the issue number and more accurate files and functions to navigate the issue as well as the fix. Hope this makes it easier to navigate and review!

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@tacaswelltacaswell added this to thev3.10.7 milestoneSep 2, 2025
Copy link
Member

@tacaswelltacaswell left a comment

Choose a reason for hiding this comment

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

@AasmaGupta Do you feel comfortable squashing this to one commit? IF not we can squash-merge.

Otherwise 👍

@AasmaGupta
Copy link
ContributorAuthor

@tacaswell I'm fine with you squash merging it from your end. Thanks!

@tacaswelltacaswell merged commit0056a47 intomatplotlib:mainSep 2, 2025
39 of 40 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestSep 2, 2025
timhoffm added a commit that referenced this pull requestSep 2, 2025
…490-on-v3.10.xBackport PR#30490 on branch v3.10.x (Fix SVG rendering error in def update_background)
@ksundenksunden mentioned this pull requestOct 9, 2025
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

v3.10.7

Development

Successfully merging this pull request may close these issues.

[Bug]: figures with SpanSelector(..., useblit=True) can't be saved to SVG or PDF

4 participants

@AasmaGupta@QuLogic@tacaswell@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp