使用matplotlib.pyplot库
import matplotlib.pyplot as plt
格式一:
figure() 整张图片 ax 图片中的各个图表 fig = plt.figure() ax = fig.add_subplot(221) # xxx : xx 一共几行 几列 ,x 第几张图 ax.plot(x轴参数,y轴参数) ax1 = fig.add_subplot(222) ax1.plot(x轴参数,y轴参数)
格式二:
fig,axes = plt.subplots(nrows= 行 ,nclo= 列) # 默认为 1 axes.plot(x轴参数,y轴参数) fig,axes = plt.subplots(nrows= 1 ,nclo= 2) # 1x2 或者2x1 的表格 axes[0].plot(x轴参数,y轴参数) axes[1].plot(x轴参数,y轴参数) fig,axes = plt.subplots(nrows= 2 ,nclo= 2) # 2x2 的表格 axes[0,0].plot(x轴参数,y轴参数) axes[0,1].plot(x轴参数,y轴参数) axes[1,0].plot(x轴参数,y轴参数) axes[1,1].plot(x轴参数,y轴参数)
未完待续:



