matplotlib的基本用法(十四)——figure图的嵌套
来源:互联网 发布:时代网络大厦 编辑:程序博客网 时间:2024/06/06 11:02
文章作者:Tyan
博客:noahsnail.com | CSDN | 简书
本文主要使用matplotlib进行图嵌套的绘制。
- Demo
import matplotlib.pyplot as plt# 定义figurefig = plt.figure()# 定义数据x = [1, 2, 3, 4, 5, 6, 7]y = [1, 3, 4, 2, 5, 8, 6]# figure的百分比, 从figure 10%的位置开始绘制, 宽高是figure的80%left, bottom, width, height = 0.1, 0.1, 0.8, 0.8# 获得绘制的句柄ax1 = fig.add_axes([left, bottom, width, height])# 绘制点(x,y)ax1.plot(x, y, 'r')ax1.set_xlabel('x')ax1.set_ylabel('y')ax1.set_title('test')# 嵌套方法一# figure的百分比, 从figure 10%的位置开始绘制, 宽高是figure的80%left, bottom, width, height = 0.2, 0.6, 0.25, 0.25# 获得绘制的句柄ax2 = fig.add_axes([left, bottom, width, height])# 绘制点(x,y)ax2.plot(x, y, 'r')ax2.set_xlabel('x')ax2.set_ylabel('y')ax2.set_title('part1')# 嵌套方法二plt.axes([bottom, left, width, height])plt.plot(x, y, 'r')plt.xlabel('x')plt.ylabel('y')plt.title('part2')plt.show()
- 结果
0 0
- matplotlib的基本用法(十四)——figure图的嵌套
- matplotlib的基本用法(一)——figure的使用
- matplotlib的基本用法(十七)——保存figure
- matplotlib的基本用法(十三)——figure绘制多图
- matplotlib的figure窗口
- matplotlib的基本用法(二)——设置坐标轴
- matplotlib的基本用法(三)——调整坐标轴
- matplotlib的基本用法(四)——设置legend图例
- matplotlib的基本用法(五)——添加annotation
- matplotlib的基本用法(六)——设置坐标轴label
- matplotlib的基本用法(七)——绘制散点图
- matplotlib的基本用法(八)——绘制柱状图
- matplotlib的基本用法(十)——绘制Image
- matplotlib的基本用法(十五)——主次坐标轴
- matplotlib的基本用法(十六)——创建动画
- matlab figure的用法
- Matlab: figure的用法
- figure,figcaption的用法
- 【网易笔试】移除重复元素
- 关于Activity的按键事件监听的坑
- 搜索1(广度优先)Red and Black
- cin.ignore的用法
- 正式开啃javascript高级程序设计1DOM
- matplotlib的基本用法(十四)——figure图的嵌套
- LPC2478 定时器1的2路PWM配置
- hihoCoder 1068 : RMQ-ST算法 (区间最值查询之 rmq算法)
- 简单谈谈Resource,Drawable和Bitmap之间的转换
- 关于Activity的按键事件监听的坑
- VM连接外网三种方式以及使用cecureCRT连接Linux.
- 24c02记忆开机次数
- redis的安装和部署
- [Python]利用高德地图api实现经纬度与地址的批量转换