Skip to content

Commit

Permalink
histogram with gradient color
Browse files Browse the repository at this point in the history
  • Loading branch information
mattijn committed Dec 13, 2023
1 parent 406ad99 commit a396ac2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/examples_arguments_syntax/histogram_gradient_color.py
Original file line number Diff line number Diff line change
@@ -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')
)
)
17 changes: 17 additions & 0 deletions tests/examples_methods_syntax/histogram_gradient_color.py
Original file line number Diff line number Diff line change
@@ -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')
)

0 comments on commit a396ac2

Please sign in to comment.