Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
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
Expected outcome
It's suposed to get the following image, or a section of this image without exploding
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]
Operating system
Windows
Matplotlib Version
3.8.0
Matplotlib Backend
TkAgg
Python version
3.10.11
Jupyter version
No response
Installation
pip