创建figure对象 设置画布大小 背景颜色
fig = plt.figure(figsize=(10,8))
创建图形图像 设置以极坐标的方式显示
ax = fig.add_subplot(111,polar=True)
生成角度列表
angle = np.linspace(0,2*np.pi,10,endpoint=False)
首尾相连 形成闭合多边形
theta = np.append(theta, theta[0])
angle = np.append(angle, angle[0])
作图 第一个 角度 第二个 数据 第三个 线条样式 第四个 线段宽度 第五个 标签文本
ax.plot(angle, centers], 'o-', linewidth=2, label=kinds[i])
填充颜色
ax.fill(angle,centers,alpha=0.5)
设置显示标签 设置标签所在位置 透明度
plt.legend(loc='best',bbox_to_anchor=(1.2,0.3,0.,0.8),framealpha=0.1,edgecolor='blue')
极坐标柱形图使用bar生成图形
theta = np.linspace(0,2*np.pi,20,endpoint=False)
radii = 10*np.random.rand(20)
width = np.pi/4*np.random.rand(20)
bar = ax.bar(theta,radii,widrth,bottom=0.0)
for a,b in zip(radii,bar):
b.set_facecolor=plt.cm.hot(a/10)
b.set_alpha=0.1