← 返回章节索引

CHAPTER 05 · 作品已接入

固定区域子图

用 add_axes() 按绝对比例放置子图。

add_axes · Fixed Position
import matplotlib.pyplot as plt

fig = plt.figure()
ax1 = fig.add_axes([0.08, 0.12, 0.55, 0.8])
ax2 = fig.add_axes([0.68, 0.35, 0.26, 0.35])
ax1.plot(x, y)
ax2.scatter(x, y)
plt.show()
固定区域子图