How do you change the size of figures drawn with matplotlib?

后端 未结 19 3007
忘掉有多难
忘掉有多难 2020-11-21 06:01

How do you change the size of figure drawn with matplotlib?

19条回答
  •  野性不改
    2020-11-21 06:25

    If you've already got the figure created you can quickly do this:

    fig = matplotlib.pyplot.gcf()
    fig.set_size_inches(18.5, 10.5)
    fig.savefig('test2png.png', dpi=100)
    

    To propagate the size change to an existing gui window add forward=True

    fig.set_size_inches(18.5, 10.5, forward=True)
    

提交回复
热议问题