marsilea.plotter.Chunk#

class Chunk(texts, fill_colors=None, *, align=None, props=None, padding=8, bordercolor=None, borderwidth=None, borderstyle=None, label=None, label_loc=None, label_props=None, **options)#

Bases: _ChunkBase

Mark groups

This is useful to mark each groups after you split the plot, the order of the chunks will align with cluster order.

Parameters:
textsarray of str

The label for each chunk

fill_colorscolor, array of color

The color used as background color for each chunk

borderwidth, bordercolor, borderstyle

Control the style of border, you can pass an array to style each group. For borderstyle, see linestyles

propsdict or array of dict

See matplotlib.text.Text

rotationfloat

How many angle to rotate the text coutner-clockwise, in degree unit

paddingfloat

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

labelstr

The label of the plot

label_loc{‘right’, ‘left’, ‘top’, ‘bottom’}

The location of the label

label_propsdict

The label properties

See also

FixedChunk

Examples

The order of chunk will be aligned with the order of cluster.

>>> import marsilea as ma
>>> from marsilea.plotter import Chunk
>>> matrix = np.random.randn(20, 20)
>>> h = ma.Heatmap(matrix)
>>> chunk = ['C1', 'C2', 'C3', 'C4']
>>> labels = np.random.choice(chunk, size=20)
>>> h.hsplit(labels=labels, order=chunk)
>>> h.add_right(Chunk(chunk, bordercolor="gray"), pad=.1)
>>> h.add_dendrogram("left")
>>> h.render()
../../_images/marsilea-plotter-Chunk-1.png