Python 类matplotlib.patches.Ellipse用于极坐标图
是否有可能在极坐标图中添加椭圆? matplotlib修补椭圆类neeeds(x,y,width,height),其中(x,y)是中心,而width和height是水平/垂直轴的总长度(直径) 如果我将中心的极坐标线转换为笛卡尔坐标线,它将不起作用Python 类matplotlib.patches.Ellipse用于极坐标图,python,matplotlib,Python,Matplotlib,是否有可能在极坐标图中添加椭圆? matplotlib修补椭圆类neeeds(x,y,width,height),其中(x,y)是中心,而width和height是水平/垂直轴的总长度(直径) 如果我将中心的极坐标线转换为笛卡尔坐标线,它将不起作用 import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Ellipse fig=plt.figure() ax=plt.subplot(11
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Ellipse
fig=plt.figure()
ax=plt.subplot(111, polar=True)
x= 200*np.cos(np.pi)
y= 200*np.sin(np.pi)
ax.add_patch(Ellipse((x,y),100,100,fill=False))
plt.show()
到目前为止我猜你现在已经做到了,但万一有人好奇或四处游荡:
el = Ellipse((0.61 * np.pi, 0.8), 0.09, 0.08, color='black')
ax.add_patch(el)
让鼠标悬停在极坐标图上,将为您提供0.61π,0.8的信息。我猜您现在已经做到了,但万一有人好奇或四处游荡:
el = Ellipse((0.61 * np.pi, 0.8), 0.09, 0.08, color='black')
ax.add_patch(el)
将鼠标悬停在极坐标图上,将为您提供0.61π,0.8的信息。我绘制矩形的方法如下: 1.-获取矩形的极坐标:
rec\u pts=ax.InvertedPolarTransform().transform(值=矩形点)
2.-使用以下坐标在极轴上绘制一条线:
line,=ax.plot(记录点[:,0],记录点[:,1])
3.-使用已在极坐标中的该线路径绘制所需的面片:
from matplotlib.patches import PathPatch
ax.add_patch(PathPatch(line.get_path()))
line.remove()
在您的情况下,为了获得笛卡尔坐标,0步是:
ellip\u coords=Ellipse((x,y),100100,fill=False)。get\u verts()我画矩形的方法如下: 1.-获取矩形的极坐标:
rec\u pts=ax.InvertedPolarTransform().transform(值=矩形点)
2.-使用以下坐标在极轴上绘制一条线:
line,=ax.plot(记录点[:,0],记录点[:,1])
3.-使用已在极坐标中的该线路径绘制所需的面片:
from matplotlib.patches import PathPatch
ax.add_patch(PathPatch(line.get_path()))
line.remove()
在您的情况下,为了获得笛卡尔坐标,0步是:
椭圆((x,y),100100,fill=False)。获取顶点()