0
行颜色我发现了以下解决方案一排颜色图例添加到Seaborn的ClusterMap:Seaborn的ClusterMap与传说
How to express classes on the axis of a heatmap in Seaborn
我有两个相关的问题:
- 如何移动传说到聚束地图的底部?
- 如果表示row_color的数据帧的索引有一个名称,则它将显示为彩色行下的标签。如何增加该标签的字体大小?
行颜色我发现了以下解决方案一排颜色图例添加到Seaborn的ClusterMap:Seaborn的ClusterMap与传说
How to express classes on the axis of a heatmap in Seaborn
我有两个相关的问题:
为了添加颜色图例,首先,您需要创建legend_TN。
import matplotlib.patches as mpatches
import seaborn as sns
legend_TN = [mpatches.Patch(color=c, label=l) for c,l in df[['tissue type','label']].drop_duplicates().values]
然后g=sns.clustermap(...)
l2=g.ax_heatmap.legend(loc='center left',bbox_to_anchor=(1.01,0.85),handles=legend_TN,frameon=True)
l2.set_title(title='tissue type',prop={'size':10})