← 返回章节索引

CHAPTER 03 · 作品已接入

坐标轴标签

用 xlabel() / ylabel() 为图表补充语义信息。

10075502500246810Axis LabelsTime (s)Amplitude
import matplotlib.pyplot as plt

plt.plot([0, 2, 4, 6, 8, 10], [15, 28, 23, 52, 60, 76])
plt.xlabel('Time (s)', color='#5b9dff')
plt.ylabel('Amplitude', color='#5b9dff')
plt.show()
坐标轴标签