Skip to content

scale_ysidex_discrete

scale_ysidex_discrete(
    name: str | None = None, **kwargs: Any
) -> FeatureSpec

Set the y side panel's own discrete x axis, e.g. the track order (R package ggside).

Parameters:

  • name (str, default: None ) –

    Axis title (not drawn: side panels show ticks and labels only).

  • **kwargs (Any) –

    Every other parameter of scale_x_discrete(), e.g. limits to order the tracks (the first one nearest the left).

Returns:

  • FeatureSpec –

    Scale specification.

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_ysidetile(aes(fill="module"))
...     + scale_ysidex_discrete(expand=[0, 0])
... )