data visualization with vega-lite and altairdata visualization with vega-lite and altair dominik...

20
Data Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many collaborators: Kanit Wongsuphasawat Arvind Satyanarayan Jeffrey Heer Jake VanderPlas … and many more

Upload: others

Post on 01-Jul-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

Data Visualization with Vega-Lite and Altair

Dominik Moritz @domoritz

�1

Interactive Data Lab @uwdata University of Washington

With many collaborators: Kanit Wongsuphasawat

Arvind Satyanarayan Jeffrey Heer

Jake VanderPlas … and many more

Page 2: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�2

Visualization concepts should map directly to

visualization implementation

Page 3: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�3

Visualization concepts should map directly to

visualization implementation

(specify the what, now the how)Declarative building blocks

Page 4: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�4

Declarative building blocks

Imperative

"Put a red circle here and a blue circle there."

Declarative

"Map <foo> to a position and <bar> to a color."

Page 5: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�4

Declarative building blocks

Imperative

"Put a red circle here and a blue circle there."

Declarative

"Map <foo> to a position and <bar> to a color."

Declarative visualization lets you think about data and relationships rather than implementation details.

Page 6: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�5

Vega-Lite{. "data": {"url": "data/iris.json"}, "mark": "point", "encoding": { "x": {

"field": "petalLength","type": "quantitative"},

"y": {"field": "sepalWidth","type": "quantitative"},

"color": {"field": "species","type": "nominal"}

} .} .

Page 7: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�6

Vega-Lite{. "data": {"url": "data/iris.json"}, "mark": "point", "encoding": { "x": {

"field": "petalLength","type": "quantitative"},

"y": {"field": "sepalWidth","type": "quantitative"},

"color": {"field": "species","type": "nominal"}

} .} .

Page 8: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�7

Vega-Lite{. "data": {"url": "data/iris.json"}, "mark": "point", "encoding": { "x": {

"field": "petalLength","type": "quantitative"},

"y": {"field": "sepalWidth","type": "quantitative"},

"color": {"field": "species","type": "nominal"}

} .} .

Page 9: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�8

Vega-Lite{. "data": {"url": "data/iris.json"}, "mark": "point", "encoding": { "x": {

"field": "petalLength","type": "quantitative"},

"y": {"field": "sepalWidth","type": "quantitative"},

"color": {"field": "species","type": "nominal"}

} .} .

Page 10: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

Statistical

Histogram Multi-series Line Chart Stripplot

Slope Graph Binned Scatterplot Area Chart

�9�9

Graphics

Page 11: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

Multi-View Graphics

�10�10

Scatterplot Matrix Concatenated & Layered View Faceted View

Page 12: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�11�11

Multi-View GraphicsInteractive

Indexed Chart Focus+Context

Cross-filtering

Page 13: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�11�11

Multi-View GraphicsInteractive

Indexed Chart Focus+Context

Cross-filtering

Page 14: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�12

Altair: Vega-Lite in Python

import altair as altfrom vega_datasets import data

Page 15: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�12

Altair: Vega-Lite in Python

import altair as altfrom vega_datasets import data

iris = data.iris()

Page 16: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�12

Altair: Vega-Lite in Python

import altair as altfrom vega_datasets import data

iris = data.iris()

alt.Chart(iris).mark_point().encode(x='petalLength',y='sepalLength',color='species'

)

Page 17: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�13

Altair: Vega-Lite in Python

import altair as altfrom vega_datasets import data

iris = data.iris()

alt.Chart(iris).mark_point().encode(x='petalLength',y='sepalLength',color='species',row='species'

)

Page 18: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�14

Altair: Vega-Lite in Python

import altair as altfrom vega_datasets import data

iris = data.iris()

alt.Chart(iris).mark_point().encode(x='petalLength',y='sepalLength',color='species'

).interactive()

Page 19: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�14

Altair: Vega-Lite in Python

import altair as altfrom vega_datasets import data

iris = data.iris()

alt.Chart(iris).mark_point().encode(x='petalLength',y='sepalLength',color='species'

).interactive()

Page 20: Data Visualization with Vega-Lite and AltairData Visualization with Vega-Lite and Altair Dominik Moritz @domoritz 1 Interactive Data Lab @uwdata University of Washington With many

�15

Learn more atvega.github.io/vega-lite/

and altair-viz.github.io

And many others…

used by