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

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

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

19条回答
  •  一生所求
    2020-11-21 06:28

    Deprecation note:
    As per the official Matplotlib guide, usage of the pylab module is no longer recommended. Please consider using the matplotlib.pyplot module instead, as described by this other answer.

    The following seems to work:

    from pylab import rcParams
    rcParams['figure.figsize'] = 5, 10
    

    This makes the figure's width 5 inches, and its height 10 inches.

    The Figure class then uses this as the default value for one of its arguments.

提交回复
热议问题