📜  删除图 matplotlib 周围的空格 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:13.441000             🧑  作者: Mango

代码示例1
plt.gca().set_axis_off()
plt.subplots_adjust(top = 1, bottom = 0, right = 1, left = 0, 
            hspace = 0, wspace = 0)
plt.margins(0,0)
plt.gca().xaxis.set_major_locator(plt.NullLocator())
plt.gca().yaxis.set_major_locator(plt.NullLocator())
plt.savefig("filename.pdf", bbox_inches = 'tight',
    pad_inches = 0)

# contributor was unsure about how it works, but nonetheless, it works!