zsh2270365028的个人博客分享 http://blog.sciencenet.cn/u/zsh2270365028

博文

[转载]Subplots spacings and margins

已有 1142 次阅读 2022-1-24 14:56 |个人分类:Python|系统分类:科研笔记|文章来源:转载

refer to: https://matplotlib.org/stable/gallery/subplots_axes_and_figures/subplots_adjust.html#sphx-glr-gallery-subplots-axes-and-figures-subplots-adjust-py

Adjusting the spacing of margins and subplots using pyplot.subplots_adjust.

Note

There is also a tool window to adjust the margins and spacings of displayed figures interactively. It can be opened via the toolbar or by callingpyplot.subplot_tool.

subplots adjust

import matplotlib.pyplot as pltimport numpy as np# Fixing random state for reproducibilitynp.random.seed(19680801)plt.subplot(211)plt.imshow(np.random.random((100, 100)))plt.subplot(212)plt.imshow(np.random.random((100, 100)))plt.subplots_adjust(bottom=0.1, right=0.8, top=0.9)cax = plt.axes([0.85, 0.1, 0.075, 0.8])plt.colorbar(cax=cax)plt.show()

Download Python source code: subplots_adjust.py

Download Jupyter notebook: subplots_adjust.ipynb




https://blog.sciencenet.cn/blog-587102-1322437.html

上一篇:[转载]Creating multiple subplots using
下一篇:2022.1.25日arXiv
收藏 IP: 119.78.226.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-27 13:42

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部