Skip to content

Commit

Permalink
Add monotone interpolation example (#2644)
Browse files Browse the repository at this point in the history
* Add line chart with interpolation

* Switch line chart to points to use wheat data

* Add stroked points

* Tidy multi series line chart

* Update multi_series_line.py

* Update multi_series_line.py

* Update line_chart_with_interpolation.py

* Delete line_chart_with_stroked_points.py
  • Loading branch information
palewire authored Jul 5, 2022
1 parent 029bc5a commit 160ab03
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
16 changes: 16 additions & 0 deletions altair/examples/line_chart_with_interpolation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Line Chart with Interpolation
-----------------------------
This chart shows a line chart with the path interpolated. A full list of interpolation methods is available `in the documentation <https://altair-viz.github.io/user_guide/generated/core/altair.LineConfig.html?highlight=interpolate#altair-lineconfig>`_.
"""
# category: line charts
import altair as alt
from vega_datasets import data

source = data.stocks()

alt.Chart(source).mark_line(interpolate="monotone").encode(
x="date:T",
y="price:Q",
color="symbol:N"
)
2 changes: 1 addition & 1 deletion altair/examples/line_chart_with_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
x='date:T',
y='price:Q',
color='symbol:N'
)
)
13 changes: 6 additions & 7 deletions altair/examples/multi_series_line.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Multi Series Line Chart
-----------------------
Multiple Series Line Chart
--------------------------
This example shows how to make a multi series line chart of the daily closing stock prices for AAPL, AMZN, GOOG, IBM, and MSFT between 2000 and 2010.
This example shows how to make a line chart with multiple series of data.
"""
# category: line charts
import altair as alt
Expand All @@ -11,8 +11,7 @@
source = data.stocks()

alt.Chart(source).mark_line().encode(
x='date',
y='price',
color='symbol',
strokeDash='symbol',
x='date:T',
y='price:Q',
color='symbol:N',
)

0 comments on commit 160ab03

Please sign in to comment.