更改每个子图的大小

时间:2019-06-06 01:28:58

标签: plot subplot

我有4个数字。我将它们绘制为子图。我希望其中两个的x轴比其他的更长。第一排子图的左侧应比右侧长。我使用了figsize命令,但出现此错误:

AttributeError: Unknown property figsize

我尝试了如下代码:

   fig = plt.figure(1)
   plt.subplot(2, 2, 1, figsize=(4,2))
   plt.plot([1, 2, 3, 4],[3, 4, 3, 4])
   plt.subplot(2, 2, 2, figsize=(2,2))
   plt.plot([1, 2],[3, 4])
   plt.subplot(2, 2, 3, figsize=(4,2))
   plt.plot([6, 2, 3, 0],[3, 4, 3, 4])
   plt.subplot(2, 2, 4, figsize=(2,2))
   plt.plot([22, 31],[222, 444])
   plt.show()

预期结果是在2x2子图中具有更长的第一列图形和较短的第二列图形。

0 个答案:

没有答案
相关问题