I am working on generating an animation with a moving rectangle using matplotlib.animation.
To do so, I first create a Rectangle (matplotlib.patches.Rectangle) at initialisation and then, within the loop, I set its coordinates, size and orientation using methods as set_height, set_width, etc.
However, nor the method set_angle nor set(angle = 30.) allow me to set the orientation of my rectangle and an error is thrown. On the other hand, both methods are supposed to be implemented, according to matplotlib documentation (https://matplotlib.org/stable/api/_as_gen/matplotlib.patches.Rectangle.html).
Here's a very basic example that gives the same error (line 19) :
import matplotlib.pyplot as plt
import matplotlib.patches as patches
fig = plt.figure()
ax = fig.add_subplot(111)
xy = [0, 0]
width = 10.
height = 5.
theta = 30.
patch = patches.Rectangle([0.5, 0.5], 0.3, 0.1,60.0, edgecolor='black', linewidth = 2, fc='r')
ax.add_patch(patch)
plt.show
patch.set_width(0.4)
patch.set_height(0.2)
#patch.set_angle(70.)
plt.show
Can anyone please help me out? Thank you all in advance!