Label plotter#

Marsilea provides a simple way to add a label any side plots.

In most cases, supplying the label parameter is enough to add a label to the plot.

You can also control the location of the label using the label_loc parameter.

The label can be customized using the label_props parameter.

Define some data

import numpy as np
import marsilea as ma
from marsilea.plotter import Colors, Labels

data = np.random.randint(0, 10, (10, 10))
h = ma.Heatmap(data, width=3, height=3)

label_blue = Colors(
    data[0],
    cmap="Blues",
    label="A Blue Heatmap",
    label_loc="bottom",
    label_props={"color": "blue", "rotation": 0},
)
label_labels = Labels([f"Label {i}" for i in data[0]], label="Labels", label_loc="left")

h.add_left(label_blue, pad=0.1)
h.add_top(label_labels)
h.render()
plot labeling
<marsilea.heatmap.Heatmap object at 0x72cbe25c1a60>

Total running time of the script: (0 minutes 0.153 seconds)

Gallery generated by Sphinx-Gallery