发布于 2020-06-18 20:06:43
我相信其他人会有更好的建议,但是有一种方法可以得到你想要的东西(不需要额外的轴艺术家),那就是使用一个极坐标投影和一个散点图和条形图。有点像
import matplotlib.pyplot as plt
import numpy as np
x = np.random.uniform(size=100)
y = np.random.uniform(size=100)
r = np.sqrt(x**2 + y**2)
phi = np.arctan2(y, x)
h, b = np.histogram(phi, bins=np.linspace(0, np.pi/2, 21), density=True)
colors = plt.cm.Spectral(h / h.max())
ax = plt.subplot(111, projection='polar')
ax.scatter(phi, r, marker='.')
ax.bar(b[:-1], h, width=b[1:] - b[:-1],
align='edge', bottom=np.max(r) + 0.2, color=colors)
# Cut off at 90 degrees
ax.set_thetamax(90)
# Set the r grid to cover the scatter plot
ax.set_rgrids([0, 0.5, 1])
# Let's put a line at 1 assuming we want a ratio of some sort
ax.set_thetagrids([45], [1])它会给

它缺少斧头标签和一些美化,但它可能是一个起点。我希望这会有所帮助。
https://stackoverflow.com/questions/62457321
复制相似问题