How to set vmax and vmin of cmap in ClusterMapPlotter()
XuejianXiong opened this issue · 7 comments
Good morning,
I would like to set a same range, i.e. vmin and vmax, of cmap in the heatmap for several figures using the function ClusterMapPlotter(). My code is as follows:
heatmap = pch.ClusterMapPlotter(
data=heatmap_data.T,
top_annotation=col_ha,
col_cluster=False,
row_cluster=True,
label="values",
col_dendrogram=False,
row_dendrogram=True,
show_rownames=True,
show_colnames=False,
legend_gap=7,
vmin=0,
vmax=30,
cmap="parula",
rasterized=True,
tree_kws={"row_cmap": "Dark2"},
ylabel=f"Protein (10 in total)",
xlabel=f"Run (100 in total)",
legend_hpad=7,
yticklabels=True,
xticklabels_kws={"labelrotation": -45, "labelcolor": "blue"},
yticklabels_kws={"labelsize": 8},
)
However, the legend in the output figure did not show the range from 0 to 30, but the real minimum and maximum in the heatmap_data.
I would like to know how to solve this problem. Thank you!
Were you using the latest version of PyComplexHeatmap? If not, please upgrade to the latest version. @XuejianXiong
Thank you @DingWB. I upgraded to the version 1.7.3, but still have the same problem.
This is weird; this bug was fixed a long time ago.
Please print print(heatmap.kwargs['vmax'],heatmap.kwargs['vmin'],heatmap.legend_kws)
after running heatmap = pch.ClusterMapPlotter(**)
and show me the output.
@XuejianXiong
Please install the latest version from github, and follow this example to see whether the legend has the same vmax and vmin as provided in the code (vmin=-2.2,vmax=2.3,).
If it is still not working, then you need to paste your data and code here.
Hi @XuejianXiong ,
How is it going? Did it work?
Hi @DingWB,
It worked! It seems my virtual environment caused issues with the package upgrading. I have to manually delete the old version and reinstall using pip.
Thank you for your help!
Best,
Xuenjian