我正在使用這個功能
它回傳一個 AxesSubplot:
我想在show_plot=True不更改函式的情況下將繪制的圖保存為 png。
我應該如何進行?
最好的祝福 !
uj5u.com熱心網友回復:
要獲得整個數字,您可以嘗試:
ax.get_figure().savefig('fig_name.png')
如果您有一個包含多個子圖的圖形,并且您只想提取一個 ( ax):
# Get the bounding box of the subplot and expand it to include the axis labels and ticks.
# You will have to play with the expanded parameters.
subplot_box = ax.get_window_extent().transformed(ax.get_figure().dpi_scale_trans.inverted()).expanded(1.2, 1.4)
ax.get_figure().savefig('subplot.png', bbox_inches=extent)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/477801.html
標籤:Python matplotlib 阴谋 熊猫动力
