我在一個 jupyter notebook 中工作,它產生了幾個數字,每個數字都保存到一個 svg 文件中。在每次打電話給savefig()我時,我bbox_inches='tight'都是這樣使用的:ax.figure.savefig(path.join(graphics_dir,'filename1.svg'),bbox_inches='tight')ax.figure.savefig(path.join(graphics_dir,'filename2.svg'),bbox_inches='tight')...是否有一些配置設置我可以用來bbox_inches='tight'為整個筆記本設置,這樣我就不必每次都傳遞它?謝謝!
1 回答

慕妹3242003
TA貢獻1824條經驗 獲得超6個贊
savefig.bbox : tight
這可以在matplotlib rc 文件中設置,也可以通過筆記本頂部的代碼進行設置,例如
plt.rcParams["savefig.bbox"] = "tight"
添加回答
舉報
0/150
提交
取消