Platform
Resources
Pricing
Sign in
Get started
Berkeley MIDS W209 Information Visualization Course
Workspace
Fork
Public
By
Kelsey Ryan
Edited
Nov 25, 2024
Fork of
Vega Embed from Altair
2
Insert cell
Insert cell
Insert cell
Insert cell
spec
=
{
return
(
{
"$schema"
:
"https://vega.github.io/schema/vega-lite/v4.17.0.json"
,
"config"
:
{
"view"
:
{
"continuousHeight"
:
300
,
"continuousWidth"
:
400
}
}
,
"data"
:
{
"name"
:
"data-c2a3e89ba9d5d1687d5e8c28d630a033"
}
,
"datasets"
:
{
"data-c2a3e89ba9d5d1687d5e8c28d630a033"
:
[
{
"a"
:
"A"
,
"b"
:
28
}
,
{
"a"
:
"B"
,
"b"
:
55
}
,
{
"a"
:
"C"
,
"b"
:
43
}
,
{
"a"
:
"D"
,
"b"
:
91
}
,
{
"a"
:
"E"
,
"b"
:
81
}
,
{
"a"
:
"F"
,
"b"
:
53
}
,
{
"a"
:
"G"
,
"b"
:
19
}
,
{
"a"
:
"H"
,
"b"
:
87
}
,
{
"a"
:
"I"
,
"b"
:
52
}
]
}
,
"encoding"
:
{
"x"
:
{
"field"
:
"a"
,
"type"
:
"nominal"
}
,
"y"
:
{
"field"
:
"b"
,
"type"
:
"quantitative"
}
}
,
"mark"
:
"bar"
}
)
}
Insert cell
Insert cell
embed
=
require
(
"vega-embed@6"
)
Insert cell
viewof
chart1
=
embed
(
spec
)
Insert cell
Insert cell
data
=
[
{
"a"
:
"A"
,
"b"
:
28
}
,
{
"a"
:
"B"
,
"b"
:
55
}
,
{
"a"
:
"C"
,
"b"
:
43
}
,
{
"a"
:
"D"
,
"b"
:
91
}
,
{
"a"
:
"E"
,
"b"
:
81
}
,
{
"a"
:
"F"
,
"b"
:
53
}
,
{
"a"
:
"G"
,
"b"
:
19
}
,
{
"a"
:
"H"
,
"b"
:
87
}
,
{
"a"
:
"I"
,
"b"
:
52
}
]
Insert cell
Insert cell
filtered_spec
=
{
return
(
{
"$schema"
:
"https://vega.github.io/schema/vega-lite/v4.17.0.json"
,
"config"
:
{
"view"
:
{
"continuousHeight"
:
300
,
"continuousWidth"
:
400
}
}
,
"data"
:
{
"name"
:
"data-c2a3e89ba9d5d1687d5e8c28d630a033"
}
,
"datasets"
:
{
"data-c2a3e89ba9d5d1687d5e8c28d630a033"
:
data
}
,
"encoding"
:
{
"x"
:
{
"field"
:
"a"
,
"type"
:
"nominal"
}
,
"y"
:
{
"field"
:
"b"
,
"type"
:
"quantitative"
}
}
,
"mark"
:
"bar"
}
)
}
Insert cell
Insert cell
viewof
chart2
=
embed
(
filtered_spec
)
Insert cell
Insert cell
viewof
min_value
=
Inputs
.
range
(
[
d3
.
min
(
data
,
d
=>
d
.
b
)
-
1
,
d3
.
max
(
data
,
d
=>
d
.
b
)
-
1
]
,
{
value
:
d3
.
max
(
data
,
d
=>
d
.
b
)
,
step
:
1
,
label
:
"Min Value"
}
)
Insert cell
Insert cell
filtered_data
=
data
.
filter
(
d
=>
d
.
b
>
min_value
)
Insert cell
Insert cell
viewof
chart
=
embed
(
filtered_spec_dynamic_data
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
spec
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
embed
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
filtered_spec
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
min_value
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
filtered_data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
filtered_spec_dynamic_data
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chart
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML