Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 根据值编辑seaborn热图注释_Python 3.x_Matplotlib_Seaborn - Fatal编程技术网

Python 3.x 根据值编辑seaborn热图注释

Python 3.x 根据值编辑seaborn热图注释,python-3.x,matplotlib,seaborn,Python 3.x,Matplotlib,Seaborn,下面是通过seaborn的热图 ax = sns.heatmap(df_heatmap, annot = True, cmap=cmap1, linewidths = 5, cbar = False, fmt=".3%", annot_kws = {"size": 12}, square = True) 现在,我想将注释设置为小数点后一位。我可以通过fmt=“.1%”实现这一点,但这会将许多注释设置为0.0%(如果它们小于0.05%)。这使得给定结果看起来不存在这种情况,但存在。我是否可以通

下面是通过seaborn的热图

ax = sns.heatmap(df_heatmap, annot = True, cmap=cmap1, linewidths = 5, cbar = False, fmt=".3%", 
annot_kws = {"size": 12}, square = True)
现在,我想将注释设置为小数点后一位。我可以通过
fmt=“.1%”
实现这一点,但这会将许多注释设置为0.0%(如果它们小于0.05%)。这使得给定结果看起来不存在这种情况,但存在。我是否可以通过某种方式编辑注释,使其包含“<0.1%”之类的内容而不是0.0%


您可能需要创建另一个数据框,在该数据框中,您可以根据需要设置值(“0.1%”用于低于0.1的值),并将其传递给Heatmap的
annot
参数检查此答案:您可能需要创建另一个数据框,在该数据框中,您可以根据需要设置值(“0.1%”用于低于0.1的值)并将其传递给Heatmap的
annot
参数检查此答案: