Open SaniyaKhullar opened 4 weeks ago
Which version are you using? Can you try the latest version? Or just install from the github: pip uninstall -y PyComplexHeatmap && pip install git+https://github.com/DingWB/PyComplexHeatmap
I think that could help. I also wanted to ask if you know how to make the diagonal elements of the symmetric matrix have a red border.
Using seaborn, it is:
# Highlight the diagonal in red
for i in range(conf_matrix.shape[0]):
ax.add_patch(plt.Rectangle((i, i), 1, 1, fill=False, edgecolor='red', lw=2))
And how to make the legend below the plot.
I was looking for any documentation for how to do this using PCH.
Please check the documentation here (https://dingwb.github.io/PyComplexHeatmap/build/html/notebooks/cpg_modules.html#Plotting-the-Dot-clustermap) about how to plot the red border.
Hi there, I checked that out. That is for different splits of the heatmap (i.e. spines). I was wondering for cases where we have just 1 heatmap. So something like this:
I implemented that using seaborn but was looking to your package for help with annotations.
So I saw this in your code:
for i in range(cm.heatmap_axes.shape[0]): for j in range(cm.heatmap_axes.shape[1]): if i != j: continue ax = cm.heatmap_axes[i][j] for side in ["top", "right", "left", "bottom"]: ax.spines[side].set_visible(True) ax.spines[side].set_color('red') ax.spines[side].set_linewidth(2)
But am not sure if it is applicable to 1 heatmap.
Also, it is not working when I'm using the new pip install approach. I'm getting this:
Further, how may I mention the legend to be horizontal.
I have no idea why this happened on your side. Everything is good on my side.
I'm seeing the same issue with version 1.8.0, only the first row of annotations are showing up when using annot=True
Please also report the version of Python and matplotlib.
I'm using matplotlib v3.9.2 and python v3.10.12
I tried upgrading to v1.9.0 of PyComplexHeatmap but it says this distribution cannot be found. Has this version been released yet?
I found a workaround, but I had to write my code based on PyComplexHeatmap and make some adjustments. I will see how to share that code.
Hi @jsharrison94 ,
Thanks for reporting the versions. I can reproduce the issue now. This is related to the matplotlib version. If you downgrade to a lower version of matplotlib, there will be no problem.
I don't know why matpltolib 3.9.2 has such kind of issue, but I will look into it.
I just tested different versions of matplotlib, it works for matpltolib <= 3.7.5. I would recommend you install matplotlib 3.7.5.
I think I have already fixed this.
Can you re-install it from GitHub and test whether it works for you? @jsharrison94 @SaniyaKhullar
pip uninstall -y PyComplexHeatmap && pip install git+https://github.com/DingWB/PyComplexHeatmap
I've installed the new version and can confirm this has fixed the issue on my end. Thank you very much for the fast response!
Hi there, I have tried running the example from https://github.com/DingWB/PyComplexHeatmap/blob/main/notebooks/kwargs.ipynb and I was unable to generate the same plot for the given data. I was seeing how to display the text labels, but it did not work.
Instead, I did not get the labels for all of the cells. This is what I got:
when I ran
label_kws
inHeatmapAnnotation
control the heatmap annotaiton labelscol_ha = pch.HeatmapAnnotation( Groups=pch.anno_simple(df.Groups,add_text=True,text_kws={'color':'black'}), AB=pch.anno_simple(df.AB,add_text=True),axis=1, Exp=pch.anno_boxplot(df_box, cmap='turbo'), verbose=0,label_side='right',
)
xticklabels_kws
andyticklabels_kws
control the ticklabels for the heatmap.plt.figure(figsize=(6, 8)) cm = pch.ClusterMapPlotter(data=df_heatmap, top_annotation=col_ha, col_split=df.Groups, col_split_order="cluster_between_groups", col_split_gap=0.5,col_cluster=True, row_cluster=True,col_dendrogram=True, label='values',show_rownames=True,show_colnames=True, tree_kws={'colors':'blue'},verbose=0,legend_gap=7, annot=True,fmt='.1g',linewidths=0.05,linecolor='gold',cmap='RdYlBu_r',
plt.show()
So you can see some incomplete text in cells. I even tried out
df_heatmap = df_heatmap.astype(float)
I have been struggling to create a proper pch heatmap with the values displayed on top. Please tell me how to do this and if this is indeed a bug that can be fixed.
For instance, for my work, this is what I'm uncovering:
when I run this:
plt.figure(figsize=(10, 12))
cm = pch.ClusterMapPlotter(data=conf_matrix, cmap='Reds',annot=True,fmt='.0f', linewidths=0.5,linecolor='black', col_cluster = False, row_cluster=False,col_dendrogram=False, row_dendrogram = False, show_rownames=True,show_colnames=True) cm plt.show()
Thanks!