Python 调整热图

Python 调整热图,python,pandas,numpy,matplotlib,heatmap,Python,Pandas,Numpy,Matplotlib,Heatmap,我看过关于创建数据热图的内容 我的数据以csv格式显示,两列的值范围为-1到1(浮点) 示例数据:我们称之为“mydataframe” 数据集包含超过100.000行。 我试过类似于这篇文章的方式: import numpy as np import numpy.random import matplotlib.pyplot as plt heatmap, xedges, yedges = np.histogram2d(df['Polarity'], df['Subjectivity'], b

我看过关于创建数据热图的内容

我的数据以csv格式显示,两列的值范围为-1到1(浮点)

示例数据:我们称之为“mydataframe”

数据集包含超过100.000行。 我试过类似于这篇文章的方式:

import numpy as np
import numpy.random
import matplotlib.pyplot as plt

heatmap, xedges, yedges = np.histogram2d(df['Polarity'], df['Subjectivity'], bins=11)
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]

plt.clf()
plt.imshow(heatmap.T, extent=extent, origin='lower')
plt.show()
我的输出如下所示:

import numpy as np
import numpy.random
import matplotlib.pyplot as plt

heatmap, xedges, yedges = np.histogram2d(df['Polarity'], df['Subjectivity'], bins=11)
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]

plt.clf()
plt.imshow(heatmap.T, extent=extent, origin='lower')
plt.show()

我必须为“bins”设置一个相当低的值(=11),以便看到超出“热点”0.0、0.0点的分布

现在我想知道的是,我如何调整色阶,使其余的颜色不仅仅是深紫色/蓝色,只有一个斑点突出。所以我想淡化这一点,放大其余的。是否有拟合参数以及如何使用


另外:如何调整轴以使其具有类似的十进制表示?

可能会将数据转换为对数刻度?如果数据的对数范数不够,还可以明确地为
vmax
设置一个值。看,例如,或@JohanC,我在所有这些方面都是新手。你们能帮我把这个应用到我的代码/数据上吗?好吧,只需复制粘贴第二篇链接文章,并进行最小的修改。如果没有数据,很难知道它在您的案例中的效果如何。您也可以尝试一个,尽管对于这么多行来说可能比较慢。使用lognorm和vmin/vmax一起工作,谢谢。