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

Python: generate Heatmap heat map based on data in Excel

編輯:Python

1.heatmap Heat map
Thermograph is often used to show the correlation coefficient matrix of a group of variables in practice , It is also useful for displaying the data distribution of contingency tables , Through the thermodynamic diagram, we can feel the difference of numerical value directly . In this paper seaborn To generate .

2. Data set presentation
The file type read in this article is Excel form , The size is 20*20 Matrix , The details are as follows :

3. Code display

// An highlighted block
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
df = pd.read_excel("C:/Users/coast/Desktop/20_20.xlsx")
#sns.set(font_scale=1.25)# Character size setting
print(df)
hm=sns.heatmap(df,vmin=-1,vmax=1,cmap="RdBu_r")
plt.show()

4. Result display

If you are interested in other parameter settings and specific contents of the thermodynamic diagram , You can refer to this article on Zhihu : Heat map reference link


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