25 lines
679 B
Python
25 lines
679 B
Python
|
"""
|
||
|
Seattle Weather Heatmap
|
||
|
-----------------------
|
||
|
This example shows the 2010 daily high temperature (F) in Seattle, WA.
|
||
|
"""
|
||
|
# category: case studies
|
||
|
import altair as alt
|
||
|
from vega_datasets import data
|
||
|
|
||
|
# Since the data is more than 5,000 rows we'll import it from a URL
|
||
|
source = data.seattle_temps.url
|
||
|
|
||
|
alt.Chart(
|
||
|
source,
|
||
|
title="2010 Daily High Temperature (F) in Seattle, WA"
|
||
|
).mark_rect().encode(
|
||
|
x='date(date):O',
|
||
|
y='month(date):O',
|
||
|
color=alt.Color('max(temp):Q', scale=alt.Scale(scheme="inferno")),
|
||
|
tooltip=[
|
||
|
alt.Tooltip('monthdate(date):T', title='Date'),
|
||
|
alt.Tooltip('max(temp):Q', title='Max Temp')
|
||
|
]
|
||
|
).properties(width=550)
|