程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

python axessubplot_ use matplotlibs savefig to save plots generated from python pandas (AxesSubPlot)

編輯:Python

I searched the Internet before and couldn't find a good way to save it. Here is an introduction:

# seaborn Chinese garbled solutionfrom matplotlib.font_manager import FontPropertiesmyfont=FontProperties(fname=r'C:\Windows\Fonts\simhei.ttf',size=20)sns.set(font=myfont.get_name()span>, color_codes=True)chazhi66_corr = chazhi66.corr(method="spearman")#Calculate the correlation coefficientplt.figure(figsize=(20,15))#figsize can specify the size of the heatmapfig=sns.heatmap(chazhi66_corr,annot=True,fmt='.2g')#annot display data on the heat map; fmt='.2g' reserve two significant figures for the datafigfig.get_figure().savefig('chazhi66_corr.png')#Keep pictures

Key words for saving images:

fig.get_figure().savefig('chazhi66_corr.png')#reserve pictures

Generated image:


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved