DingWB / PyComplexHeatmap

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

Minimum y limit set incorrectly in (stacked) barplots #97

Closed benbfly closed 1 week ago

benbfly commented 1 week ago

https://github.com/DingWB/PyComplexHeatmap/blob/cde658fd5305f56fff77d525e78956a7acdf93b9/PyComplexHeatmap/annotations.py#L880

In anno_barplot, y limit minimum currently set as: Min = np.nanmin(self.df.sum(axis=1).values) if self.stacked else np.nanmin(self.df.values)

The most typical use case is to have barplots starting at 0. Starting a barplot at the minimum value is not what the user would want in most cases. In stacked barplots, it's especially bad because you can't even see all the categories.

DingWB commented 1 week ago

As you can see, I would set this Min when ylim is None, To set custom min and max, you can pass parameter ylim to the function.

image

DingWB commented 1 week ago

Oh, I am sorry. ylim was an internal parameter that was not accessible to the users. I have already fixed this issue now, you can pass parameter ylim to any kind of annotations function. You need to re-install from the GitHub.