How to rotate matplotlib.patches.Polygon
? The output from the code below shows nothing.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib as mpl
fig, ax = plt.subplots(figsize=(10,3))
x = [0.3,0.6,.5,.4]
y = [0.7,0.7,0.9,0.9]
trapezoid = patches.Polygon(xy=list(zip(x,y)), fill=False)
t_start = ax.transData
t = mpl.transforms.Affine2D().rotate_deg(-45)
t_end = t_start + t
trapezoid.set_transform(t_end)
print(repr(t_start))
print(repr(t_end))
ax.add_patch(trapezoid)
plt.show()