Matplotlib绘制极坐标散点图
程序员文章站
2022-07-14 10:05:49
...
Matplotlib编程实现
import numpy as np
import matplotlib.pyplot as plt
num = 150
r = 2 * np.random.rand(num)
theta = 2 * np.pi * np.random.rand(num)
area = 200 * r**2
colors = theta
ax = plt.subplot(111, projection='polar')
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)
plt.show()