1. 添加图标题,坐标轴标题,图例 添加图标题有plt.xlabel()和axes.set_xlabel()方法,添加坐标轴标题和图例也基本类似,其中注意的是绝大多数的 plt 函数都可以直接转换成 axes 方法(例如 plt.plot() → axes.plot()、 plt.legend() → axes.legend() 等),但是并非所有的命令都可以这样用。尤其是用来设置坐...
# 数据subjects = ['语文', '数学', '英语', '物理', '化学', '生物']male_scores = [85.5, 91, 72, 59, 66, 55]female_scores = [94, 82, 89.5, 62, 49, 53]x = np.arange(len(subjects)) 学科标签位置width = 0.35 # 柱形宽度 绘制柱形图fig, ax = plt.subplots()rects1 = ax....