Skip to content

Commit

Permalink
doc: add histogram with gradient color (#3282)
Browse files Browse the repository at this point in the history
* histogram with gradient color

* change to pinkyellowgreen
  • Loading branch information
mattijn authored Dec 16, 2023
1 parent 406ad99 commit 4d06175
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 `pinkyellowgreen`.
"""
# 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='pinkyellowgreen')
)
)
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 `pinkyellowgreen`.
"""
# 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='pinkyellowgreen')
)

0 comments on commit 4d06175

Please sign in to comment.