Python 来自seaborn的Matplot区域颜色调色板

Python 来自seaborn的Matplot区域颜色调色板,python,matplotlib,seaborn,Python,Matplotlib,Seaborn,我有几个matplotlib区域图和一些使用seaborn的热图 我想知道的是将面积图中的颜色与热图中的颜色匹配,即使用热图中的颜色进行面积图。只是想让颜色一致 我知道颜色可以用这样的东西来改变,例如我想要灰度: seq_col = sns.color_palette("Greys_r", 61) #sets the charts to greyscale, _r reverse the scale, 61 determines the number of steps sns.set_pale

我有几个matplotlib区域图和一些使用seaborn的热图

我想知道的是将面积图中的颜色与热图中的颜色匹配,即使用热图中的颜色进行面积图。只是想让颜色一致

我知道颜色可以用这样的东西来改变,例如我想要灰度:

seq_col = sns.color_palette("Greys_r", 61) 
#sets the charts to greyscale, _r reverse the scale, 61 determines the number of steps
sns.set_palette(seq_col)
但常规代码热图使用的是什么?我什么也找不到

请在下面找到一个小例子,我还将附上我想为matplotlib绘图“提取”其颜色的热图


在邮件上核对答案。seaborn的默认颜色映射是
sns.cm.rocket
因此,也许
df=df.plot.area(title=“随时间分配的权重”,cmap=sns.cm.rocket)
就是您想要的。
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

# dataframe
df = {"Stock1":[1/3, 1/3, 1/3], "Stock2":[1/3, 1/3, 1/3], "Stock3":[1/3, 1/3, 1/3], 
      "day":["1.1.2020", "2.1.2020", "3.1.2020"]}
df = pd.DataFrame(df).set_index("day")

# stacked plot
df = df.plot.area(title="Weight allocation over time")
df.legend(loc='upper right')
plt.minorticks_off()

# heatmap
V = np.full((20,20), 20)
plt.figure(figsize=(7, 7))
g1 = sns.heatmap(V)

plt.show()