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]: Curves goes to infinity with limited points #26823

Open
@carlos-adir

Description

@carlos-adir

Bug summary

I'm trying to plot a closed curve made of linear and quadratic bezier usingPath andPathPatch. But somehow it goes to infinity as shown in the images

Can anyone verify if this error is reproductible?

Code for reproduction

frommatplotlibimportpyplotaspltfrommatplotlib.pathimportPathfrommatplotlib.patchesimportPathPatchpoints= [[0,2],[-4,2],[-4,-2],[0,-2],[2,-2],[2,0],[2,2],[0,2]]codes= [1,2,2,2,3,3,3,79]fig,ax=plt.subplots()ax.grid()path=Path(points,codes)patch=PathPatch(path,color="lime",alpha=0.25)ax.add_patch(patch)path=Path(points,codes)patch=PathPatch(path,edgecolor="red",facecolor="none",lw=2)ax.add_patch(patch)plt.xlim(-8,8)plt.ylim(-8,8)plt.show()

Actual outcome

Image without zoom
image

Image with zoom
image

Expected outcome

It's suposed to get the following image, or a section of this image without exploding

Perfect image
image

Additional information

By inserting the point(0, 2) and the code3 at the end, it solves globally the issue, but the red curve still explodes to infinity when a specific zoom in applied, as shown in the image.

points= [[0,2],[-4,2],[-4,-2],[0,-2],[2,-2],[2,0],[2,2],[0,2],[0,2]]codes= [1,2,2,2,3,3,3,3,79]

New zoomed image
image

Operating system

Windows

Matplotlib Version

3.8.0

Matplotlib Backend

TkAgg

Python version

3.10.11

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    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