Source code for altair_recipes.areaplot

from .common import warn_not_distinct, choose_kwargs
from .signatures import bivariate_recipe, color
import altair as alt
from autosig import autosig, Signature, param
from enum import Enum

[docs]class StackType(Enum): auto = None # no, must not pass anything true = True false = False normalize = "normalize"
[docs]@autosig( bivariate_recipe + Signature( color=color(default=None, position=3), stack=param(, position=4, converter=StackType, docstring="""StackType One of `` (automatic selection), `StackType.true` (force), `StackType.false` (no stacking) and `StackType.normalize` (for normalized stacked)""", ), ) ) def areaplot( data=None, x=0, y=1, color=None,, height=600, width=800 ): """Generate a areaplot.""" warn_not_distinct(data, x, color) if stack is not y = alt.Y(y, stack=stack.value) opt_args = choose_kwargs(locals(), ["color"]) return ( alt.Chart(data=data, height=height, width=width) .mark_area(opacity=1) .encode(x=x, y=y, **opt_args) )