如何融合热图(或具有散点的散点图)和散点图?

时间:2020-01-20 18:47:36

标签: python matplotlib scatter-plot

在我的项目中,我处理很多情节,我需要融合两个情节。但是第一个还不完整,这里是第一个的代码:

import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv("data/forestfires.csv")

x_number_list = df.X.tolist()
y_number_list = df.Y.tolist()

第一张图:

temperature_number_list = df.temp.tolist()
temperature_number_list = [int(round(x,0)) for x in temperature_number_list]

gridsize = 30 
plt.hexbin(x_number_list, y_number_list, C=temperature_number_list)   
cb = plt.colorbar()
cb.set_label('density')
plt.show() 

给出:

enter image description here

但是我需要更改此图,因为我希望该点具有更大的半径,但是当半径变大时,它会变亮...因此,我们可以看到像这样的热图那样的扩散点:

enter image description here (在我的“ heatmap”版本中,如果我们没有信息,如果有灰色,那会很酷)

一旦我变换了这张图,我需要将他与另一张这样的图融合起来:

area_number_list = df.area.tolist()
area_number_list = [int(round(x+1,0)) for x in area_number_list]
# Draw point based on above x, y axis values.
plt.scatter(x_number_list, y_number_list, s=area_number_list, cmap='jet')

# Set chart title.
plt.title("Position of wildfire and their burnarea ##by mean heat##")

# Set x, y label text
plt.show()

给出:

enter image description here

实际上,由于第一个图形的颜色,我需要填充该点,然后仅用白色圆圈代替点,这样会更加清晰。

我还有最后一个问题:如何更改颜色条的颜色?我需要它成为“喷射”托盘。

那么有可能融合这些图形吗?

0 个答案:

没有答案
相关问题