exit_fade ¶
exit_fade(alpha: float = 0) -> FeatureSpec
Fade marks out as they exit (gganimate exit_fade).
A mark that has no partner in the next state moves from its own opacity to
alpha over the transition (see enter_fade). Without any exit effect,
leaving marks disappear when the transition starts.
Parameters:
-
alpha(float, default:0) –The opacity exiting marks end at, between 0 and 1.
Returns:
-
FeatureSpec–The effect (kind
"animation"), added to a plot with+.
Raises:
-
SpecError–If
alphais not a number between 0 and 1.
Examples:
>>> from ggrust import *
>>> exit_fade(alpha=0.2).props()["exit"]
[{'name': 'fade', 'alpha': 0.2}]
A bar that fades out when its fruit is no longer sold:
>>> data = {"year": [2021, 2021, 2022], "fruit": ["apple", "pear", "apple"], "sold": [3, 2, 4]}
>>> plot = (
... ggplot(data, aes("fruit", "sold"))
... + geom_col()
... + transition_states("year")
... + exit_fade()
... )
A bar that fades out when its fruit is no longer sold