matplotlib pyplot:子块大小

2024-09-30 08:28:15 发布

您现在位置:Python中文网/ 问答频道 /正文

如果我画一个单独的图如下,它将是大小(x*y)。

import matplotlib.pyplot as plt
plt.plot([1, 2], [1, 2])

但是,如果我在同一行中绘制3个子图,则每个子图的大小都是((x/3)*y)。

fig, ax = plt.subplots(1, 3, sharey = True)
for i in range(3):
    ax[i].plot([1, 2], [1, 2])

如何获得这3个子块,每个子块的大小(x*y)?


Tags: inimporttrueforplotmatplotlibasfig

热门问题