输入:无
输入:无
处理:至少建立
处理:至少建立4个属性值,绘制雷达图
个属性值,绘制雷达图
输出:中国乒乓球选手的雷达图
输出:中国乒乓球选手的雷达图
输入:无
输入:无
处理:至少建立
处理:至少建立4个属性值,绘制雷达图
个属性值,绘制雷达图
输出:中国乒乓球选手的雷达图
输出:中国乒乓球选手的雷达图
import numpy as np
import matplotlib.patches as patches
import matplotlib.pyplot as plt
ax = plt.axes(polar = True)
theta = np.linspace(0, 2 * np.pi, 4, endpoint = False)
radius = .25 + .75 * np.random.random(size = len(theta))
points = np.vstack((theta, radius)).transpose()
plt.gca().add_patch(patches.Polygon(points, color = 'c'))
angles = [a if a <=360. else a - 360. for a in np.arange(90, 90+360, 360.0/4)]
titles = ['敏捷','速度','耐性','智力']
ax.set_thetagrids(angles, labels=titles, weight="bold", color="black")
plt.rcParams['font.sans-serif'] = ['SimSun']
plt.show()