DingWB / PyComplexHeatmap

PyComplexHeatmap: A Python package to plot complex heatmap (clustermap)
https://dingwb.github.io/PyComplexHeatmap/
MIT License
295 stars 32 forks source link

change color bar length #88

Open GangLiTarheel opened 2 months ago

GangLiTarheel commented 2 months ago

Hi,

Very nice package! I am trying to change one of my color bars. Make it range larger than the default. Is this some feature the package already has? I could not find this in the template. image

An ideal result would look like this: https://proplot.readthedocs.io/en/latest/colorbars_legends.html

While some annotations just need the fixed length as the package's default, some color bars might use the whole/half y/x axis.

Best, Gang

DingWB commented 2 months ago

Hi @GangLiTarheel ,

Usually, there are many legends to plot, including main heatmap cmap legend and other annotation legends. The length of cmap legend was hard-coded to be 15 mm: https://github.com/DingWB/PyComplexHeatmap/blob/09065ff3a57638b43ec79b9b27c8074bedf0f9ac/PyComplexHeatmap/utils.py#L774

What you proposed is a good point. However, I don't know how to implement the whole axis colorbar without affecting the current layout. For example, when there are many legends to plot, if we plot one of the legends spanning the whole axis, then how about the other legends? Please let me know if you have a good idea.

GangLiTarheel commented 2 months ago

Hi @DingWB ,

Thank you for your responses! I think ideally, it will be nice to have two separate columns of annotations. For example, main heatmap annotation span the whole axis for one column; and the column annotation for a separate column or on the bottom of figure.

Besides, it might be good to put 15 as a parameter for user to control.

Best, Gang

DingWB commented 2 months ago

Thank you. I will think about it and collect some ideas from other users.