简体   繁体   English

扩大Python Seaborn热图

[英]Make Python seaborn heatmap bigger

I use a heat map in Python to show the correlation between all parameters I have. 我在Python中使用热图来显示我拥有的所有参数之间的相关性。 The number of parameters however are that large that the heat map becomes to small to show the data. 但是,参数的数量太大,以至于热图变得很小以显示数据。

Heat Map 热图

The heat map is created using seaborn: 使用seaborn创建热图:

seaborn.heatmap(df.corr())

I tried to make it bigger using: 我试图使用以下方法使其更大:

plt.subplots(figsize=(10,10))
seaborn.heatmap(df.corr())

but this didn't work since the image just remained its current size. 但这不起作用,因为图像仅保持其当前大小。

Does someone know another way of doing this? 有人知道这样做的另一种方式吗? Or maybe another way to clearly plot the correlations between all parameters? 还是另一种清晰地绘制所有参数之间相关性的方法?

Regards, Ganesh 问候,Ganesh

You should create the figure first (similar to how you tried) using: 您应该首先使用以下方法创建图形(类似于您尝试的方法):

fig, ax = plt.subplots(figsize=(10,10))

Then, pass in ax as an argument to seaborn.heatmap 然后,将ax作为参数传递给seaborn.heatmap

import matplotlib.pyplot as plt
import seaborn

fig, ax = plt.subplots(figsize=(10,10))
seaborn.heatmap(df.corr(), ax=ax)
plt.show()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM