From a396ac2e0784565327ddba1fb9477c5e0d754d01 Mon Sep 17 00:00:00 2001 From: Mattijn van Hoek Date: Wed, 13 Dec 2023 22:29:48 +0100 Subject: [PATCH 1/2] histogram with gradient color --- .../histogram_gradient_color.py | 23 +++++++++++++++++++ .../histogram_gradient_color.py | 17 ++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tests/examples_arguments_syntax/histogram_gradient_color.py create mode 100644 tests/examples_methods_syntax/histogram_gradient_color.py diff --git a/tests/examples_arguments_syntax/histogram_gradient_color.py b/tests/examples_arguments_syntax/histogram_gradient_color.py new file mode 100644 index 000000000..404d58906 --- /dev/null +++ b/tests/examples_arguments_syntax/histogram_gradient_color.py @@ -0,0 +1,23 @@ +""" +Histogram with Gradient Color +----------------------------- +This example shows how to make a histogram with gradient color. +The low-high IMDB rating is represented with the color scheme `redyellowgreen`. +""" +# category: distributions +import altair as alt +from vega_datasets import data + +source = data.movies.url + +alt.Chart(source).mark_bar().encode( + alt.X("IMDB_Rating:Q", + bin=alt.Bin(maxbins=20), + scale=alt.Scale(domain=[1, 10]) + ), + alt.Y('count()'), + alt.Color("IMDB_Rating:Q", + bin=alt.Bin(maxbins=20), + scale=alt.Scale(scheme='redyellowgreen') + ) +) \ No newline at end of file diff --git a/tests/examples_methods_syntax/histogram_gradient_color.py b/tests/examples_methods_syntax/histogram_gradient_color.py new file mode 100644 index 000000000..92ccc9ce2 --- /dev/null +++ b/tests/examples_methods_syntax/histogram_gradient_color.py @@ -0,0 +1,17 @@ +""" +Histogram with Gradient Color +----------------------------- +This example shows how to make a histogram with gradient color. +The low-high IMDB rating is represented with the color scheme `redyellowgreen`. +""" +# category: distributions +import altair as alt +from vega_datasets import data + +source = data.movies.url + +alt.Chart(source).mark_bar().encode( + alt.X("IMDB_Rating:Q").bin(maxbins=20).scale(domain=[1, 10]), + alt.Y('count()'), + alt.Color("IMDB_Rating:Q").bin(maxbins=20).scale(scheme='redyellowgreen') +) \ No newline at end of file From 949da81e07a177d51b8b05758dc38d81e1e2d25d Mon Sep 17 00:00:00 2001 From: Mattijn van Hoek Date: Sat, 16 Dec 2023 15:03:10 +0100 Subject: [PATCH 2/2] change to pinkyellowgreen --- tests/examples_arguments_syntax/histogram_gradient_color.py | 4 ++-- tests/examples_methods_syntax/histogram_gradient_color.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/examples_arguments_syntax/histogram_gradient_color.py b/tests/examples_arguments_syntax/histogram_gradient_color.py index 404d58906..6bd3e7b6e 100644 --- a/tests/examples_arguments_syntax/histogram_gradient_color.py +++ b/tests/examples_arguments_syntax/histogram_gradient_color.py @@ -2,7 +2,7 @@ Histogram with Gradient Color ----------------------------- This example shows how to make a histogram with gradient color. -The low-high IMDB rating is represented with the color scheme `redyellowgreen`. +The low-high IMDB rating is represented with the color scheme `pinkyellowgreen`. """ # category: distributions import altair as alt @@ -18,6 +18,6 @@ alt.Y('count()'), alt.Color("IMDB_Rating:Q", bin=alt.Bin(maxbins=20), - scale=alt.Scale(scheme='redyellowgreen') + scale=alt.Scale(scheme='pinkyellowgreen') ) ) \ No newline at end of file diff --git a/tests/examples_methods_syntax/histogram_gradient_color.py b/tests/examples_methods_syntax/histogram_gradient_color.py index 92ccc9ce2..645453475 100644 --- a/tests/examples_methods_syntax/histogram_gradient_color.py +++ b/tests/examples_methods_syntax/histogram_gradient_color.py @@ -2,7 +2,7 @@ Histogram with Gradient Color ----------------------------- This example shows how to make a histogram with gradient color. -The low-high IMDB rating is represented with the color scheme `redyellowgreen`. +The low-high IMDB rating is represented with the color scheme `pinkyellowgreen`. """ # category: distributions import altair as alt @@ -13,5 +13,5 @@ alt.Chart(source).mark_bar().encode( alt.X("IMDB_Rating:Q").bin(maxbins=20).scale(domain=[1, 10]), alt.Y('count()'), - alt.Color("IMDB_Rating:Q").bin(maxbins=20).scale(scheme='redyellowgreen') + alt.Color("IMDB_Rating:Q").bin(maxbins=20).scale(scheme='pinkyellowgreen') ) \ No newline at end of file