【发布时间】:2018-11-23 19:24:25
【问题描述】:
我是 Python 新手。我需要使用这样的数据框在每个网格中绘制带有注释的热图:
t=pd.DataFrame({'ReturnType':['ReturnWithoutReceipt','Return With Receipt',
'ReturnWithoutReceipt','Return With Proof Of Purchase','Return With Proof Of Purchase',
'Return With Receipt'],
'Payment':['Card','Cash','Cash','Cash','Card','Card'],
'Hour':[11,12,12,14,16,16],
'value':[1,26,3,67,17,37],
'Label':['1.0--11','26.0--12','3.0--12','67.0--14','17.0--16','37.0--16']})
在我的热图中,行是 ReturnType,列是 Payment。颜色由价值决定。标签需要显示在每个网格中。因此,该图将如下所示:
那么如何使用 matplotlib 或 seaborn 来实现呢?
【问题讨论】:
标签: python pandas matplotlib heatmap seaborn