Skip to content

Commit

Permalink
Merge pull request #2642 from palewire/patch-17
Browse files Browse the repository at this point in the history
Update ranged_dot_plot.py
  • Loading branch information
mattijn authored Jul 3, 2022
2 parents 756e4de + 3379771 commit f0b8a7c
Showing 1 changed file with 7 additions and 7 deletions.
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)

0 comments on commit f0b8a7c

Please sign in to comment.