import matplotlib.pyplot as plt
import numpy as np


fig, axes = plt.subplots(2, 2)
def showim():
    for i in range(2):
        for j in range(2):
            axes[i,j].plot(np.random.randint(10,size=10))
            # 为每个子图添加标题
            axes[i,j].set_title("picture "+str(i)+" "+str(j))
            fig.tight_layout()
            # 为每个子图去掉坐标轴刻度
            axes[i,j].set_xticks([])
            axes[i,j].set_yticks([])

showim()
plt.show()

 

matplotlib中在for中画出多张图

 

相关文章:

  • 2022-12-23
  • 2021-08-31
  • 2022-01-01
  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
猜你喜欢
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-09-04
  • 2021-10-18
  • 2022-12-23
相关资源
相似解决方案