回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>使用plotu()函数围绕一个特定于plotu的点旋转plotu()。但是,面片始终围绕原点旋转。我不知道如何确保面片对象围绕特定点旋转。在</p>
<p>代码如下:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib as mpl
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_xlim(-0.05,1);ax.set_ylim(-0.05,1);
grid('on');
#Rotate rectangle patch object
ts = ax.transData
tr = mpl.transforms.Affine2D().rotate_deg_around(0.2,0.5,10)
t= ts + tr
rec0 = patches.Rectangle((0.2,0.5),0.25,0.2,alpha=0.5)
ax.add_patch(rec0)
#Rotated rectangle patch
rect1 = patches.Rectangle((0.2,0.5),0.25,0.2,color='blue',alpha=0.5,transform=t)
ax.add_patch(rect1);
#The (desired) point of rotation
ax.scatter([0.0,0.2],[0.0,0.5],c=['g','r'],zorder=10)
txt = ax.annotate('Desired point of rotation',xy=(0.2,0.5),fontsize=16,\
xytext=(0.25,0.35),arrowprops=dict(arrowstyle="->",connectionstyle="arc3,rad=-.2"))
txt2 = ax.annotate('Actual point of rotation',xy=(0.0,0.0),fontsize=16,\
xytext=(0.15,0.15),arrowprops=dict(arrowstyle="->",connectionstyle="arc3,rad=.2"))
plt.show()
</code></pre>
<p>下面是上述代码的输出:</p>
<p><img src="https://i.stack.imgur.com/J2OfB.png" alt="enter image description here"/></p>
<p>我也试着做翻译,围绕着_的原点旋转,然后把你翻译回来。然而,翻译转换也不起作用。任何简单翻译的帮助/例子也会非常有用。在</p>
<p>谢谢。在</p>