Skip to content

Commit

Permalink
Merge pull request #532 from eitanlees/line-with-ci
Browse files Browse the repository at this point in the history
Line chart with Confidence Interval Band Example
  • Loading branch information
jakevdp authored Feb 28, 2018
2 parents 27f9aa6 + 5f42264 commit d3db1a5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions altair/vegalite/v2/examples/line_with_ci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Line chart with Confidence Interval Band
========================================
This example shows how to make a line chart with a confidence interval Band
"""

import altair as alt
from vega_datasets import data

cars = data.cars()

line = alt.Chart(cars).mark_line().encode(
x='Year',
y='mean(Miles_per_Gallon)'
)

confidence_interval = alt.Chart(cars).mark_area(opacity=0.3).encode(
x='Year',
y=alt.Y('ci0(Miles_per_Gallon)', axis=alt.Axis(title='Miles/Gallon')),
y2='ci1(Miles_per_Gallon)'
)

chart = confidence_interval + line

0 comments on commit d3db1a5

Please sign in to comment.