我是靠谱客的博主 知性天空,这篇文章主要介绍python入门学习笔记12(plot in plot 图中图),现在分享给大家,希望可以做个参考。

CODE1:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import matplotlib.pyplot as plt fig=plt.figure() x=[1,2,3,4,5,6,7] y=[1,3,4,2,5,8,6] left,bottom,width,height=0.1,0.1,0.8,0.8 ax1=fig.add_axes([left,bottom,width,height]) # 设置figure的比例大小 ax1.plot(x,y,'r') ax1.set_xlabel('x') ax1.set_ylabel('y') ax1.set_title('title') left,bottom,width,height=0.2,0.55,0.25,0.25 ax2=fig.add_axes([left,bottom,width,height]) # 设置ax2的位置以及大小 ax2.plot(y,x,'b') ax2.set_xlabel('x') ax2.set_ylabel('y') ax2.set_title('title inside 1') plt.axes([.6,.2,.25,.25]) # 设置axes的位置和大小的另外一种方式 plt.plot(y[::-1],x,'g') plt.xlabel('x') plt.ylabel('y') plt.title('title inside 2') plt.show()

RESULT:
在这里插入图片描述

最后

以上就是知性天空最近收集整理的关于python入门学习笔记12(plot in plot 图中图)的全部内容,更多相关python入门学习笔记12(plot内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(72)

评论列表共有 0 条评论

立即
投稿
返回
顶部