fig.set_figheight and fig.set_figwidth not working

前端 未结 1 1277
离开以前
离开以前 2021-01-28 09:16

Why is this code not changing the size of the figure plotted?

   fig1, ax1 = plt.subplots(nrows=1, ncols=3)
   fig1.set_figheight = 30
   fig1.set_figwidth = 30
         


        
1条回答
  •  抹茶落季
    2021-01-28 09:43

    fig1.set_figheight = 30 assigns 30 to the .set_figheight attribute. While previously fig1.set_figheight was a method that could be used to change the height of the figure, from now on it is, well, simply 30.

    The solution is simple: Use the method instead of destroying it.

    fig1.set_figheight(30)
    

    Note that because you have overwritten the method you will need to restart the kernel, such that matplotlib can be reimported and the attribute is restored to its original state.

    0 讨论(0)
提交回复
热议问题