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

antialiasing control using e.g. the shape-rendering attribute in svg output #12609

Open
Labels
backend: svgkeepItems to be ignored by the “Stale” Github Action
@Acebulf

Description

@Acebulf

Bug report

Bug summary

Linewidth is treated differently for patches.Rectangle and lines.Line2D if exported to .svg, even with anti-aliasing turned on. This problem does not occur when exported to .png

Code for reproduction

importmatplotlibasmplimportmatplotlib.pyplotaspltimportmatplotlib.patchesaspatchesimportmatplotlib.linesaslinesmpl.rcParams['patch.antialiased']=Falsempl.rcParams['lines.antialiased']=Falsefig,ax=plt.subplots()l=lines.Line2D((0,0),(0,1),linewidth=2,color='k')ax.add_line(l)l=lines.Line2D((1,1),(0,1),linewidth=2,fillstyle='full')ax.add_line(l)p=patches.Rectangle((0,1),1,1,linewidth=2,fill=())ax.add_patch(p)magic_line=lines.Line2D((0,0.5),(1,1),linewidth=2,color='k',antialiased=False)ax.add_line(magic_line)ax.add_line(lines.Line2D((0.5,0.5),(0,0.9)))ax.set_xlim(-1,1.1)ax.set_ylim(-0.5,2.1)plt.savefig("problem.svg",dpi=900)

Actual outcome
The problematic area is where the overlay between the rectangle and the magic_line end (0.5,1) The issue in this troubleshooting example is slight and might need magnification to be seen, but becomes very noticable in cases of small figures exported to svg and scaled up afterwards,

image

By compiling it in .svg and .png we get different results, with what I think is antialiasing being applied differently even while being disabled and the same linewidth. This might also be two bugs in one.

**Expected outcome**The outcome should resemble the output for .png **Matplotlib version**<!--Please specify your platform and versions of the relevant libraries you are using:-->  * Operating system: Win 10  * Matplotlib version: 2.1.2  * Matplotlib backend : module://ipykernel.pylab.backend_inline  * Python version: 3.6.4  * Spyder version: 3.2.6  * Matplotlib installed from Anaconda with default settings<!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--><!--If you installed from conda, please specify which channel you used if not the default-->

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend: svgkeepItems to be ignored by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp