zoukankan      html  css  js  c++  java
  • plt绘制子图

    plt绘制子图

    plt.subplot(221)
    
    # equivalent but more general
    # 子图1
    ax1 = plt.subplot(2, 2, 1)
    
    # add a subplot with no frame
    # 子图2
    ax2 = plt.subplot(222, frameon=False)
    
    # add a polar subplot
    # 子图3
    plt.subplot(223, projection='polar')
    
    # add a red subplot that shares the x-axis with ax1
    # 子图4
    plt.subplot(224, sharex=ax1, facecolor='red')
    

    删除一个子图。

    plt.subplot(221)
    
    # equivalent but more general
    ax1 = plt.subplot(2, 2, 1)
    
    # add a subplot with no frame
    ax2 = plt.subplot(222, frameon=False)
    
    # add a polar subplot
    plt.subplot(223, projection='polar')
    
    # add a red subplot that shares the x-axis with ax1
    plt.subplot(224, sharex=ax1, facecolor='red')
    
    # delete ax2 from the figure
    plt.delaxes(ax2)
    

    image-20211102151041377

    x = [1,2,3]
    y1 = x
    y2 = [4,5,6]
    y3 = [7,8,9]
    y4 = [12,9,11]
    
    ax1 = plt.subplot(221)
    ax1.margins(0.05)
    ax1.plot(x,y1)
    # 标题
    ax1.set_title('1',loc='left')
    
    ax2 = plt.subplot(222)
    ax2.margins(0.05)
    ax2.plot(x,y2)
    # 标题
    ax2.set_title('2')
    
    ax3 = plt.subplot(223)
    ax3.margins(0.05)
    ax3.plot(x,y3)
    # 标题
    ax3.set_title('3')
    
    ax4 = plt.subplot(224)
    ax4.margins(0.05)
    ax4.plot(x,y3)
    # 标题
    ax4.set_title('4')
    

    image-20211102151136377

  • 相关阅读:
    danci8
    禁止选择文本
    danci6
    danci5
    java 学习编译
    自动代码模板文件
    java 学习5 .io
    java 学习4 callback 回调 和泛型
    java 学习3。集合
    java 学习3。类 和 继承
  • 原文地址:https://www.cnblogs.com/Cookie-Jing/p/15505404.html
Copyright © 2011-2022 走看看