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

[Bug]: Inconsistent line anti-aliasing in PolyCollection #30549

Open
@lganic

Description

@lganic

Bug summary

When running a poly collection, depending on the order of points (which shouldn't matter for < 4 points) the line anti-aliasing flips, which creates a different image. (So, creating pytests based on images where the point ordering is non-deterministic doesn't work)

Code for reproduction

See this repo, where I have laid out a testing env that reproduces the effect

https://github.com/lganic/matplotlib-collection-alias-testing.git

However this is the pertinent bit:

@pytest.mark.mpl_image_comparedeftest_collection():# Define one trianglestuff= [[0,0], [1,0], [1,1]]random.shuffle(stuff)# stuff = [[0, 0], [1, 0], [1, 1]] # Running with this commented out, will usually result in a different image.polys= [np.array(stuff)]print(polys)fig,ax=plt.subplots()ax.set_aspect('equal')# Add shaded trianglecoll=PolyCollection(polys,facecolors="lightblue",edgecolors="k",linewidths=1)ax.add_collection(coll)# Plot verticespts=np.vstack(polys)# stack back into N×2 array for scatterax.scatter(pts[:,0],pts[:,1],c='red',zorder=5)returnfig

Actual outcome

Zoomed in diff:

Image

Diff highlighted in red:

Image

Expected outcome

Both produced lines should have matching anti-aliasing.

Additional information

No response

Operating system

Windows 11

Matplotlib Version

3.10.6

Matplotlib Backend

qtagg

Python version

3.13.1

Jupyter version

N/A

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp