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

  • 相关阅读:
    android-sdk环境变量配置
    2018/08/04
    python 读取配置文件ini ---ConfigParser
    关于自动化测试框架搭建的前期考虑问题
    Jmeter中用例禁用
    Jmeter创建一个http请求
    基本的sql语法
    sql创建表格时出现乱码
    Jmeter安装
    Java环境搭建
  • 原文地址:https://www.cnblogs.com/Cookie-Jing/p/15505404.html
Copyright © 2011-2022 走看看