Open wahaha233333 opened 1 week ago
I ran the same code, and everything is good. Can you test different versions of Python and matplotlib and help find the issue?
The same issue as @wahaha233333, I didn't see the legend with the code above.
Hi @winglet0996
Thanks for your feedback; it is helpful.
Indeed, there was something wrong with the PyPI 1.7.9. But no problem on the GitHub.
So, I released a new version, 1.8.0. You can either upgrade to 1.8.0 using pip or directly install from github pip uninstall -y PyComplexHeatmap && pip install git+https://github.com/DingWB/PyComplexHeatmap
Please let me know whether it works or not @wahaha233333 @winglet0996
That helps! Thanks a lot for your quick reply.
It works!, thank you so much.
df = pd.DataFrame(['GroupA'] 5 + ['GroupB'] 5, columns=['AB']) df['CD'] = ['C'] 3 + ['D'] 3 + ['G'] 4 df['EF'] = ['E'] 6 + ['F'] 2 + ['H'] 2 df['F'] = np.random.normal(0, 1, 10) df.index = ['sample' + str(i) for i in range(1, df.shape[0] + 1)] df.head() df_heatmap = pd.DataFrame(np.random.randn(30, 10), columns=['sample' + str(i) for i in range(1, 11)]) df_heatmap.index = ["Fea" + str(i) for i in range(1, df_heatmap.shape[0] + 1)] df_heatmap.iloc[1, 2] = np.nan
plt.figure(figsize=(3.5, 6)) cm = pch.ClusterMapPlotter(data=df_heatmap, col_cluster=True,row_cluster=True, col_split=df.AB,row_split=2, col_split_gap=0.5,row_split_gap=0.8, label='values',row_dendrogram=True, show_rownames=True,show_colnames=True, row_names_side='right', tree_kws={'row_cmap': 'Set1','colors':'blue'},verbose=0,legend_gap=5, cmap='RdYlBu_r',xticklabels_kws={'labelrotation':-90,'labelcolor':'blue'}) plt.savefig("example0.pdf", bbox_inches='tight') plt.show()
version: 1.7.9 python: 3.11.0 matplotlib: 3.9.2
this is what i got