Improve subplot size/spacing with many subplots in matplotlib

前端 未结 6 1744
一整个雨季
一整个雨季 2020-11-22 12:56

Very similar to this question but with the difference that my figure can be as large as it needs to be.

I need to generate a whole bunch of vertically-stacked plots

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 13:28

    You can use plt.subplots_adjust to change the spacing between the subplots (source)

    call signature:

    subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)
    

    The parameter meanings (and suggested defaults) are:

    left  = 0.125  # the left side of the subplots of the figure
    right = 0.9    # the right side of the subplots of the figure
    bottom = 0.1   # the bottom of the subplots of the figure
    top = 0.9      # the top of the subplots of the figure
    wspace = 0.2   # the amount of width reserved for blank space between subplots
    hspace = 0.2   # the amount of height reserved for white space between subplots
    

    The actual defaults are controlled by the rc file

提交回复
热议问题