Closed as not planned
Description
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:
from matplotlib import pyplot as plt
from matplotlib.transforms import Affine2D
from matplotlib.patches import Circle, Rectangle
fig = 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')
If I then replace the definition of the patches with:
rotation = Affine2D().rotate(1.5) + ax.transData
r = 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:
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).