matplotlib中的复杂极坐标图

问题描述 投票:1回答:1

我想创建一个类似于以下的极坐标图:

plot

我找不到如何在不同角度范围内添加两个不同函数的示例。我不需要中间的径向偏移,但可能会很好。任何指针,已知的例子都是超级!

python matplotlib visualization polar-coordinates
1个回答
0
投票

[似乎与其他使用matplotlib绘制一样,即,如果要绘制两条曲线,则需要多次调用plt.polar

这里是一个例子:

import numpy as np
import matplotlib.pyplot as plt

blue_thetas = np.linspace(np.pi/3, 2*np.pi/3, 100)
red_thetas = np.linspace(4*np.pi/3, 6*np.pi/3, 100)

blue_rs = np.random.uniform(4, 6, len(blue_thetas))
red_rs = np.random.uniform(3, 5, len(red_thetas))

red_curve = plt.polar(red_thetas, red_rs, c='r', label="calculated")
blue_curve = plt.polar(blue_thetas, blue_rs, c='b', label="measured")
plt.legend(loc=10)

plt.xticks(np.concatenate((red_thetas[::20], blue_thetas[::30])))

plt.title("test polar image")
plt.show()

来源:https://matplotlib.org/3.1.1/gallery/misc/transoffset.html#sphx-glr-gallery-misc-transoffset-py

另一个对您可能有用的stackoverflow帖子是:floating radial axis

polar plot example

© www.soinside.com 2019 - 2024. All rights reserved.