- 积分
- 5344
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-8-28
- 最后登录
- 1970-1-1
|
发表于 2020-6-16 21:24:25
|
显示全部楼层
本帖最后由 Masterpiece 于 2020-6-16 21:26 编辑
polar chart外圈这个是labels用set_xticks和set_xticklabels去控制。另外matplotlib中有关text的一切事物都支持LATEX公式。
- import numpy as np
- import matplotlib.pyplot as plt
- fig,axl = plt.subplots(1,2, subplot_kw={'projection':'polar'},figsize=(9,5))
- ax=axl[0]
- ax.set_theta_zero_location("N")
- ax.set_theta_direction('clockwise')
- ax.set_xticks([(i/4)*np.pi for i in range(8)])
- ax.set_xticklabels(['N','NE','E','SE','S','SW','W','NW'],fontdict={'weight':'bold','size':15,'color':'b'})
- ax.set_rmax(3)
- ax.set_rticks([])
- ax.set_title(r"PM2.5 $\mu g \cdot m^{-3}$",size=13, va='bottom',pad=20)
- ax=axl[1]
- ax.set_theta_zero_location("N")
- ax.set_theta_direction('clockwise')
- ax.set_xticks([(i/4)*np.pi for i in range(8)])
- ax.set_xticklabels(['北','东北','东','东南','南','西南','西','西北'],fontdict={'family':'SimHei','size':15,'color':'red'})
- ax.set_rmax(3)
- ax.set_rticks([])
- ax.set_title(r"Article style: PM2.5 $\rm \mu g \cdot m^{-3}$",size=13, va='bottom',pad=20)
- plt.savefig('polar.png',dpi=200,bbox_inches='tight')
- plt.show()
复制代码
|
|