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

Add text inside Colors #26

Closed aadimator closed 7 months ago

aadimator commented 7 months ago

Is there a way to achieve something like below using Colors or some other plotter?

image

I tried using Colors and TextMesh but haven't been able to figure out how to make them work together like this.

Mr-Milk commented 7 months ago

You can use Chunk and set the background colors, but you need to split the main plot first.

aadimator commented 7 months ago

Perfect. I thought we can only use Chunk once for a given split. It works in this scenario, but in case where I can't split the plot, is there another way to achieve it, or is this the only way for now?

Again, thanks for the help. It's really appreciated.

Mr-Milk commented 7 months ago

Yes, the Chunk can be used multiple times. Can you give an example of when you can't split the plot but want to add text? I'm not sure if this is what you want, but if you want to label multiple splits with the same name, a FixedChunk allows you to merge multiple chunks, the downside is that it will not reorder if you add a dendrogram.

aadimator commented 7 months ago

image

Let's say that in the above plot, I've split based on TME, and I also want to add some text on the Biopsy location row or Surgery row (could be its label, or the number of samples or anything else). Can I achieve that in any way?

Mr-Milk commented 7 months ago

In the current Marsilea, this is impossible. In Surgery, you have green blocks in two places, so it's difficult to tell where to put the text. But if you really want this feature, you can implement your own RenderPlan.

If you want to add extra text, I would add it to the label, something like Surgery (Yes: 10, No: 20).

By the way, if you plan to use Marsilea in a publication, please consider citing our preprint, it will help a lot in keeping this project alive, https://doi.org/10.1101/2024.02.14.580236

aadimator commented 7 months ago

Yes, I understand that the above example wasn't a perfect one (just sent a screenshot of whichever one was readily available at that time).

Sure thing. I'll definitely cite it if I use it in my publication. Thanks for such a great tool.