"""
author:魏振东
data:2019.12.13
func:雷达图
"""
import numpy as np
import matplotlib.pyplot as plt
labels = np.array(['团战','发育','输出','KDA','生存'])
dataLenth = 5
data = np.array([10,7,12,9,3])
angles = np.linspace(0, 2*np.pi, dataLenth, endpoint=False)
data = np.concatenate((data, [data[0]]))
angles = np.concatenate((angles, [angles[0]]))
fig = plt.figure(figsize=(5,5))
ax = fig.add_subplot(111, polar=True)
floor = np.floor(data.min())
ceil = np.ceil(data.max())
for i in np.arange(floor, ceil +2,2):
ax.plot(angles, [i] * (int(len(labels)) + 1), '-', lw=0.3, color='black')
ax.spines['polar'].set_visible(False)
ax.grid(False)
ax.set_yticks([])
ax.plot(angles, data, 'ro-', linewidth=2)
ax.set_thetagrids(angles * 180/np.pi, labels, fontproperties="SimHei")
ax.set_title("王者战绩", va='bottom', fontproperties="SimHei")
ax.grid(True)
plt.show()