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

Update ranged_dot_plot.py #2642

Merged
merged 2 commits into from
Jul 3, 2022
Merged
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
14 changes: 7 additions & 7 deletions altair/examples/ranged_dot_plot.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
Ranged Dot Plot
-----------------
This example shows a ranged dot plot that uses 'layer' to convey changing life expectancy for the five most populous countries (between 1955 and 2000).
---------------
This example shows a ranged dot plot to convey changing life expectancy for the five most populous countries (between 1955 and 2000).
"""
# category: other charts
import altair as alt
from vega_datasets import data

source = data.countries.url

chart = alt.layer(
chart = alt.Chart(
data=source
).transform_filter(
filter={"field": 'country',
Expand All @@ -19,13 +19,13 @@
"oneOf": [1955, 2000]}
)

chart += alt.Chart().mark_line(color='#db646f').encode(
line = chart.mark_line(color='#db646f').encode(
x='life_expect:Q',
y='country:N',
detail='country:N'
)
# Add points for life expectancy in 1955 & 2000
chart += alt.Chart().mark_point(
points = chart.mark_point(
size=100,
opacity=1,
filled=True
Expand All @@ -34,10 +34,10 @@
y='country:N',
color=alt.Color('year:O',
scale=alt.Scale(
domain=['1955', '2000'],
domain=[1955, 2000],
range=['#e6959c', '#911a24']
)
)
).interactive()

chart
(line + points)