Skip to content

label_context

label_context(
    *,
    multi_line: bool | None = None,
    sep: str | None = None,
) -> Labeller

Label facet strips with the value, or variable: value for several variables.

facet_wrap over two or more columns gets label_both, one column gets label_value. Each margin of a facet_grid has one variable, so it gets the value.

Examples:

>>> from ggrust import *
>>> data = {"age": [1, 3, 2, 4], "weight": [4, 6, 8, 12],
...         "pet": ["cat", "cat", "dog", "dog"], "year": [1, 2, 1, 2]}
>>> plot = ggplot(data, aes("age", "weight")) + geom_point()
>>> plot = plot + facet_wrap(["pet", "year"], labeller=label_context)