Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: histogram with gradient color #3282

Merged
merged 2 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
)