Matplotlib adjust figure margin

后端 未结 7 780
盖世英雄少女心
盖世英雄少女心 2021-01-31 15:48

The following code gives me a plot with significant margins above and below the figure. I don\'t know how to eliminate the noticeable margins. subplots_adjust does

7条回答
  •  悲哀的现实
    2021-01-31 16:19

    I just discovered how to eliminate all margins from my figures. I didn't use tight_layout(), instead I used:

    import matplotlib.pyplot as plt
    fig = plt.figure(figsize=(20,20))
    ax = plt.subplot(111,aspect = 'equal')
    plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=0, hspace=0)
    

    Hope this helps.

提交回复
热议问题