How to make subplots using matplotlib in python

Поделиться
HTML-код
  • Опубликовано: 14 ноя 2023
  • import matplotlib.pyplot as plt
    fig, ((ax1,ax2),(ax3,ax4)) = plt.subplots(2,2, figsize=(10,3), sharex=True, sharey=True)
    plt.subplots_adjust(wspace=0.01,hspace=0)
    x = [1,2,3,4,5]
    y1 = [2,4,5,7,10]
    y2 = [11,8,4,6,1]
    ax1.plot(x,y1)
    ax2.plot(x,y2)
    ax3.plot(x,y1)
    ax4.plot(x,y2)
    ax1.set_title("axis1")
    plt.suptitle("super title")
    plt.show()
  • НаукаНаука

Комментарии •