[Matplotlib] tight_layout()

  • With tight_layout()
import numpy as np
import matplotlib.pyplot as plt

x=np.linspace(-3,3,100)
y1=np.sin(x)
y2=np.cos(x)
y3=np.tan()
y4=np.exp(x)

fig, ax = plt.subplots(2, 2)

ax[0, 0].plot(x, y1)
ax[0, 1].plot(x, y2)
ax[1, 0].plot(x, y3)
ax[1, 1].plot(x,y4)

ax[0, 0].set_title("Sine function")
ax[0, 1].set_title("Cosine function")
ax[1, 0].set_title("Tangent function")
ax[1, 1].set_title("Exponential function")

fig.tight_layout()
plt.show()

Figures would be placed tightly with proper spaces between them


<<:  [Python] os.walk()

>>:  CMoney工程师战斗营weekly3

学习架构

从基础到进阶,逐步学习成为一个专业 iOS App 开发者 ...

[Day4] Face Detection - 使用Google Cloud Vision API

reference: medium - Filtering Image content with ...

Day 26 - Rancher Fleet Kubernetes 应用程序部署

本文将於赛後同步刊登於笔者部落格 有兴趣学习更多 Kubernetes/DevOps/Linux 相...

【Day12】漏洞分析Vulnerability Analysis(一)

哈罗~ 前面几天我们介绍了线上情蒐工具、网路扫描与列举技术, 而攻击者会利用软件或硬体的不完善来对组...

Day8 Android - 切换页面(Intent)

intent可以使一个Activity切换至另一个Activity,而一个application可能...