admin管理员组文章数量:1334375
I recently got the warning MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "figsize" which is no longer supported as of 3.3 and will become an error in 3.6
for the command
plt.savefig("Beta-transition-log_ME.png",format='png',dpi=300,bbox_inches='tight',transparent=True,figsize=(16,14))
This is hard since basically every tutorial and slack overflow question about how to tune the size of a matplotlib plot mentions using figsize() as a method to do so. In the light of this being depreciated, what is the solution?
This is my entire code block with the error:
plt.errorbar(Beta, ME_avg, yerr=error, fmt="o")
plt.ylabel('Density averaged kinetic energy ',fontsize=11)
plt.xlabel('AV-normalized cooling time',fontsize=12)
plt.title('Space & time-averaged final saturated energy')
plt.axhline(avg_u,color='red',label = 'Isothermal')
plt.legend()
plt.loglog()
plt.savefig("Beta-transition-log_ME.png",format='png',dpi=300,bbox_inches='tight',transparent=True,figsize=(16,14))
plt.show()
I recently got the warning MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "figsize" which is no longer supported as of 3.3 and will become an error in 3.6
for the command
plt.savefig("Beta-transition-log_ME.png",format='png',dpi=300,bbox_inches='tight',transparent=True,figsize=(16,14))
This is hard since basically every tutorial and slack overflow question about how to tune the size of a matplotlib plot mentions using figsize() as a method to do so. In the light of this being depreciated, what is the solution?
This is my entire code block with the error:
plt.errorbar(Beta, ME_avg, yerr=error, fmt="o")
plt.ylabel('Density averaged kinetic energy ',fontsize=11)
plt.xlabel('AV-normalized cooling time',fontsize=12)
plt.title('Space & time-averaged final saturated energy')
plt.axhline(avg_u,color='red',label = 'Isothermal')
plt.legend()
plt.loglog()
plt.savefig("Beta-transition-log_ME.png",format='png',dpi=300,bbox_inches='tight',transparent=True,figsize=(16,14))
plt.show()
Share
Improve this question
asked Nov 20, 2024 at 16:58
Pundarikaksha KavipurapuPundarikaksha Kavipurapu
615 bronze badges
1 Answer
Reset to default 3Set the figure size when creating the figure:
plt.figure(figsize=(16, 14))
Save without the figsize argument:
plt.savefig("Beta-transition-log_ME.png", format='png', dpi=300, bbox_inches='tight', transparent=True)
本文标签:
版权声明:本文标题:python - Matplotlib: savefig, ""figsize" which is no longer supported as of 3.3 and will become an er 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742342940a2456965.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论