Skip to content

geom_xsidetile

geom_xsidetile(
    mapping: FeatureSpec | None = None, **kwargs: Any
) -> LayerSpec

Draw tiles in the x side panel (R package ggside).

The x side panel sits above the panel (below with ggside(x_pos="bottom")) and shares its x axis.

Without its own y mapping, the layer is one track labelled by its fill (or color) column: aes(fill="cell_type") draws the track cell_type.

Parameters:

  • mapping (FeatureSpec, default: None ) –

    Aesthetic mapping from aes(). Along x it maps through the main panel's x scale; across the band through the band's own y scale (scale_xsidey_*()).

  • **kwargs (Any) –

    Every other parameter of geom_tile().

Returns:

  • LayerSpec –

    The side layer.

Examples:

>>> from ggrust import *
>>> data = {
...     "cell": ["c1", "c2", "c3", "c4"] * 2,
...     "gene": ["CD3E"] * 4 + ["MS4A1"] * 4,
...     "expression": [2.1, 1.8, 0.2, 0.1, 0.3, 0.1, 2.4, 2.0],
...     "cell_type": ["T", "T", "B", "B"] * 2,
...     "module": ["T genes"] * 4 + ["B genes"] * 4,
... }
>>> plot = (
...     ggplot(data, aes("cell", "gene", fill="expression"))
...     + geom_tile()
...     + new_scale_fill()
...     + geom_xsidetile(aes(fill="cell_type"))
... )