marsilea.plotter.Labels#

class marsilea.plotter.Labels(labels, align=None, padding=2, text_props=None, **options)#

Bases: _LabelBase

Add text labels

Parameters:
labelsarray of str
alignstr

Which side of the text to align

paddingfloat

The buffer space between text and the adjcent plots, in points unit

text_propsdict

A dict of array that control the text properties for each text.

optionsdict

Pass to matplotlib.text.Text

Examples

To set the text properties for each text, use text_props

>>> labels = np.arange(20)
>>> colors = ["r" if labels % 2 else "b" for labels in labels]
>>> import marsilea as ma
>>> from marsilea.plotter import Labels
>>> h = ma.Heatmap(np.random.randn(20, 20))
>>> h.add_right(Labels(labels, text_props={'color': colors}))
>>> h.render()
../../_images/marsilea-plotter-Labels-1.png