热图Seaborn阿诺错误 [英] Heat Maps Seaborn Annot Error
本文介绍了热图Seaborn阿诺错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
至于延伸到我的previous <一个href=\"http://stackoverflow.com/questions/31069153/bubble-plot-or-heatmap-in-matplotlib/31077694#31077694\">question
As extension to my previous question
使用相同的数据集,我无法得到注解完成。
With same data set I am not able to get the annotation done.
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set()
df = pd.read_csv('heat_map_data.csv')
df3 = df.copy()
for c in ['Place','Name']:
df3[c] = df3[c].astype('category')
sns.heatmap(df3.pivot_table(index='Place', columns='Name', values='00:00:00', annot=True) )
plt.show()
错误:
Traceback (most recent call last):
File "heatmap_sns.py", line 13, in <module>
sns.heatmap(df3.pivot_table(index='Place', columns='Name', values='00:00:00', annot=True) )
TypeError: pivot_table() got an unexpected keyword argument 'annot'
请建议什么可以修复?
推荐答案
ANNOT = TRUE
是热图的参数
,而不是 pivot_table
:
sns.heatmap(df3.pivot_table(index='Place', columns='Name', values='00:00:00'),
annot=True)
这篇关于热图Seaborn阿诺错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文