ease_aes ¶
ease_aes(
default: str = "linear", **aesthetics: str
) -> FeatureSpec
Set how values move between states (gganimate ease_aes).
An ease maps the progress of a transition to the share of the way a value
has moved: "linear" moves evenly, "cubic-in-out" starts and ends
slowly, "bounce-out" bounces at the end. Names are tweenr's: linear,
or one of quadratic, cubic, quartic, quintic, sine, circular, exponential,
elastic, back and bounce followed by -in, -out or -in-out.
Parameters:
-
default(str, default:"linear") –The ease of every aesthetic not named.
-
**aesthetics(str) –An ease per aesthetic, e.g.
y="bounce-out"orcolor="sine-in".x(y) also sets the x-like (y-like) aesthetics not named, such asxminandxend. Stat variables can be named too (count). A laterease_aes()replaces an earlier one as a whole.
Returns:
-
FeatureSpec–The easing (kind
"animation"), added to a plot with+.
Raises:
-
SpecError–If an ease name is unknown (with a close match when there is one).
Examples:
>>> from ggrust import *
>>> data = {"year": [2021, 2022, 2023], "sold": [10, 12, 15]}
>>> plot = (
... ggplot(data, aes("year", "sold"))
... + geom_point()
... + transition_states("year")
... + ease_aes("cubic-in-out", y="bounce-out")
... )
>>> plot.as_dict()["animation"]["ease"]["aesthetics"]
{'y': 'bounce-out'}
An elastic move for the positions, an even one for the color:
>>> plot = (
... ggplot(data, aes("year", "sold", color="sold"))
... + geom_point(size=6)
... + transition_states("year")
... + ease_aes("elastic-out", color="linear")
... )
An elastic move for the positions, an even one for the color