Skip to content

new_scale_color

new_scale_color() -> FeatureSpec

Start a new color scale (ggnewscale): new_scale("color").

Returns:

  • FeatureSpec –

    The marker, to add to a plot with +.

Examples:

>>> from ggrust import *
>>> data = {"x": [1, 2, 3, 4], "y": [2, 4, 3, 5], "group": ["a", "a", "b", "b"]}
>>> plot = (
...     ggplot(data, aes("x", "y"))
...     + geom_point(aes(color="y"), size=5)
...     + new_scale_color()
...     + geom_text(aes(label="group", color="group"), nudge_y=0.3)
...     + scale_color_brewer(palette="Set1")
... )