为什么两个点不能在图中显示(matplotlib)?

时间:2016-09-18 00:38:40

标签: python matplotlib

图1显示了数据点1

1enter image description here

我在python中通过matplotlib绘制了图形,但数据点无法完全显示。图中的右下角没有显示两个点。两个坐标是(-0.6731984257692413,6.0),( - 0.7105983383119769,7.0)。我不知道为什么。任何人都可以帮忙吗?

import matplotlib.pyplot as plt
theta = [0.8975979010256552, 2.6927937030769655, 0, -0.6731984257692413, 0.0, -1.7951958020513104, -0.8975979010256552, -1.7951958020513104, -2.6927937030769655, -0.5235987755982988, -0.59839860068377, -0.8975979010256552, -1.1967972013675403, 1.7951958020513104, -0.5609986881410344, -0.59839860068377, -0.6357985132265057, -0.7105983383119769]
r = [1.0, 0.5, 0, 6.0, 1.0, 1.5, 1.0, 1.0, 1.0, 4.5, 4.0, 4.0, 4.0, 0.5, 4.5, 4.5, 4.5, 7.0]
colors = [1.13290242331, 0.81108163706000003, 0, 0.94180655750400011, 0.90356396220000001, 0.946707749135, 1.09650064153, 1.2068422679700002, 1.1150923324999999, 2.4619798379700004, 0.83030335877799999, 0.87957520389799992, 0.872155341769, 0.92537488526299994, 2.70431872671, 1.10024483211, 0.89817718522000012, 1.1547139643100002]

plt.subplot(111,polar=True)
cc=plt.scatter(theta,r,c=colors,cmap=plt.cm.hsv)

cc.set_alpha(0.75)
plt.grid(color='y', alpha=0.8, linestyle='dashed', linewidth=1)
plt.colorbar()
plt.thetagrids([30])
plt.show()

1 个答案:

答案 0 :(得分:0)

在Andras Deak的帮助下,我使用plt.ylim([0, max(r)+1])来解决这个问题。谢谢。