diff --git a/tests/examples_arguments_syntax/cumulative_count_chart.py b/tests/examples_arguments_syntax/cumulative_count_chart.py index f6e1df075..6ee7ad277 100644 --- a/tests/examples_arguments_syntax/cumulative_count_chart.py +++ b/tests/examples_arguments_syntax/cumulative_count_chart.py @@ -17,5 +17,5 @@ sort=[{"field": "IMDB_Rating"}], ).mark_area().encode( x="IMDB_Rating:Q", - y="cumulative_count:Q" + y=alt.Y("cumulative_count:Q", stack=False) ) diff --git a/tests/examples_methods_syntax/cumulative_count_chart.py b/tests/examples_methods_syntax/cumulative_count_chart.py new file mode 100644 index 000000000..a9b08361c --- /dev/null +++ b/tests/examples_methods_syntax/cumulative_count_chart.py @@ -0,0 +1,21 @@ +""" +Cumulative Count Chart +---------------------- +This example shows an area chart with cumulative count. +Adapted from https://vega.github.io/vega-lite/examples/area_cumulative_freq.html + +""" +# category: distributions + +import altair as alt +from vega_datasets import data + +source = data.movies.url + +alt.Chart(source).transform_window( + cumulative_count="count()", + sort=[{"field": "IMDB_Rating"}], +).mark_area().encode( + x="IMDB_Rating:Q", + y=alt.Y("cumulative_count:Q").stack(False) +)