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 when trying to clip a patch with a transformed patch #6709

Closed as not planned
Labels
status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: path handling
@astrofrog

Description

@astrofrog

I am trying to plot a circle patch clipped by a rectangular patch that has been transformed, for example by a rotation. However, the clipping doesn't seem to be working right. First, here's what it looks like without rotation:

frommatplotlibimportpyplotaspltfrommatplotlib.transformsimportAffine2Dfrommatplotlib.patchesimportCircle,Rectanglefig=plt.figure()ax=fig.add_subplot(1,1,1,aspect='equal')r=Rectangle((-1,-3),2,6,facecolor='none',edgecolor='none')ax.add_patch(r)c=Circle((0,0),radius=2,edgecolor='none',facecolor='0.75')ax.add_patch(c)c.set_clip_path(r)ax.set_xlim(-3,3)ax.set_ylim(-3,3)fig.savefig('circles_norot.png')

circles_norot

If I then replace the definition of the patches with:

rotation=Affine2D().rotate(1.5)+ax.transDatar=Rectangle((-1,-3),2,6,facecolor='none',edgecolor='none',transform=rotation)ax.add_patch(r)c=Circle((0,0),radius=2,edgecolor='none',facecolor='0.75',transform=rotation)ax.add_patch(c)c.set_clip_path(r)

I get:

circles

which doesn't look right (the width of the dark grey shouldn't change, and should be rotated 1.5 radians
compared to original example above).

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Actiontopic: path handling

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp