是否可以有一个标准的矩形(又名笛卡尔)图,但显示在一组极坐标轴上?
我只想要由 polar() 函数提供的灰色边框的遮蔽外观,但我不想将我的坐标转换为极坐标,并使用 polar()。
请您参考如下方法:
如果您只想在直角坐标系中调用两个数组,同时在极坐标网格上绘图,这将满足您的需求。在这里,x 和 y 是你的数组,在矩形中,会给你一条 x=y 线。它返回相同的趋势线,但在极坐标中。如果你需要更多的掩码,这实际上限制了一些显示的数据,那么在 for 中插入一行类似这样的循环:for r < 5.0:或者您对面具的任何标准。
from math import cos, sin, atan2, sqrt
import matplotlib.pyplot as plt
plt.clf()
width, height = matplotlib.rcParams['figure.figsize']
size = min(width, height)
# make a square figure
fig = figure(figsize=(size, size))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')
x = range(10)
y = range(10)
r = []
phi = []
for ii in range(len(x)):
r.append(sqrt(x[ii]**2.+y[ii]**2.))
phi.append(atan2(y[ii],x[ii]))
ax.scatter(phi,r)
show()
