Python利用matplotlib做图中图及次坐标轴

您所在的位置:网站首页 折线图设置次坐标轴 Python利用matplotlib做图中图及次坐标轴

Python利用matplotlib做图中图及次坐标轴

2024-07-10 05:47| 来源: 网络整理| 查看: 265

图中图 准备数据 import matplotlib.pyplot as plt fig = plt.figure() x = [1, 2, 3, 4, 5, 6, 7] y = [1, 3, 4, 2, 5, 8, 6]

- 大图 首先确定大图左下角的位置以及宽高: 注意,4个值都是占整个figure坐标系的百分比。在这里,假设figure的大小是10x10,那么大图就被包含在由(1, 1)开始,宽8,高8的坐标系内。

# below are all percentage left, bottom, width, height = 0.1, 0.1, 0.8, 0.8 ax1 = fig.add_axes([left, bottom, width, height]) # main axes ax1.plot(x, y, 'r') ax1.set_xlabel(


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3