Marsilea-viz / marsilea

Declarative creation of composable visualization for Python (Complex heatmap, Upset plot, Oncoprint and more~)
https://marsilea.rtfd.io/
MIT License
166 stars 6 forks source link

Ability to add "label" to the Labels #24

Closed aadimator closed 6 months ago

aadimator commented 7 months ago

Could we get an ability (or hack) to somehow label the column of the Labels. For example: image

In the above image, if we could add a label to the bottom or top, specifying what the text of the Labels represent, it would be wonderful, just like we're doing for other Number and CenterBar, etc.

On a side note, same label functionality for Chunks would also be greatly appreciated. Just an option that user can set based on his preferences.

Mr-Milk commented 7 months ago

Yes, you can hack it.

This is a feature that I don't know if I should make available to every plotter. If you find it useful, feel free to comment!

All you need to do:

# Let's say you have a Label plotter, but this applies to any plotter

l = Labels(...)
l.allow_labeling =True
l.set_label("my label", loc="right", props={"color": "r"})
aadimator commented 7 months ago

That worked for my use case. I'd say we can definitely enable it for every plotter, if technically possible, as that'd give more control to the end user as to however he wants to create his plots.

aadimator commented 7 months ago

I've been trying to use this hack on Chunk, but so far, I haven't been able to make it work. If it's not enabled for Chunk, I think it can be a good option to have for that.

Mr-Milk commented 7 months ago

I will add it, Chunk is a bit complicated, so the label rendering process is overwritten, and I forgot to add it back. The label feature will be enabled for all plotters in the next release.

Mr-Milk commented 6 months ago

@aadimator Labeling is now available in v0.3.3