基本绘图
import matplotlib.pyplot as plt x = [1, 2, 3, 4, 5] y = [2, 4, 6, 8, 10] plt.plot(x, y) plt.xlabel('X轴') plt.ylabel('Y轴') plt.title('示例图表') plt.show()
子图
fig, (ax1, ax2) = plt.subplots(1, 2) ax1.plot(x, y) ax2.bar(x, y)
转载请注明:周志洋的博客 » Python实用技巧-数据可视化