Platform
Resources
Pricing
Sign in
Get started
lilpeasant
Workspace
Fork
Published
By
lilpeasant
Edited
Sep 28, 2019
Fork of
Untitled
•
2 forks
Insert cell
md
`# Exonerees`
Insert cell
Insert cell
d3
=
require
(
"d3@5"
)
Insert cell
data
=
d3
.
csv
(
"https://www.sfu.ca/~lha54/exonerees.csv"
,
d3
.
autoType
)
Insert cell
dataMinAge
=
d3
.
min
(
data
,
d
=>
d
.
Age
)
Insert cell
data
.
filter
(
d
=>
d
.
data
=
"Female"
)
.
reduce
(
(
count
,
d
)
=>
count
+
1
,
0
)
Insert cell
import
{
vl
}
from
'@vega/vega-lite-api'
Insert cell
md
` ## Age Range of Exonerees`
Insert cell
vl
.
markBar
(
)
.
data
(
data
)
.
encode
(
vl
.
x
(
)
.
fieldQ
(
'Age'
)
.
bin
(
{
maxbins
:
20
}
)
,
vl
.
y
(
)
.
count
(
)
)
.
render
(
)
Insert cell
md
` ## Age Range of Exonerees in Relation to Race `
Insert cell
VegaLite
=
require
(
"vega-embed@5"
)
Insert cell
VegaLite
(
{
data
:
{
values
:
data
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
bin
:
true
,
field
:
"Age"
,
type
:
"nominal"
}
,
y
:
{
aggregate
:
"count"
,
field
:
"*"
,
type
:
"quantitative"
}
,
color
:
{
field
:
"Race"
,
type
:
"nominal"
}
}
}
)
Insert cell
md
` ## Count of Exonerees per Race`
Insert cell
VegaLite
(
{
data
:
{
values
:
data
}
,
mark
:
"bar"
,
encoding
:
{
y
:
{
field
:
"Race"
,
type
:
"nominal"
}
,
x
:
{
aggregate
:
"count"
,
field
:
"*"
,
type
:
"quantitative"
}
,
color
:
{
field
:
"Race"
,
type
:
"nominal"
}
}
}
)
Insert cell
VegaLite
(
{
data
:
{
values
:
data
}
,
mark
:
{
type
:
"line"
}
,
encoding
:
{
x
:
{
field
:
"Age"
,
type
:
"quantitative"
}
,
y
:
{
aggregate
:
"count"
,
field
:
"*"
,
type
:
"quantitative"
}
,
color
:
{
field
:
"Race"
,
type
:
"nominal"
}
}
}
)
Insert cell
md
` ## Gender Count`
Insert cell
VegaLite
(
{
data
:
{
values
:
data
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
field
:
"Sex"
,
type
:
"nominal"
}
,
y
:
{
aggregate
:
"count"
,
field
:
"*"
,
type
:
"quantitative"
}
,
}
}
)
Insert cell
md
` ## Count of Exonerees per State`
Insert cell
VegaLite
(
{
data
:
{
values
:
data
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
field
:
"State"
,
type
:
"nominal"
}
,
y
:
{
aggregate
:
"count"
,
field
:
"*"
,
type
:
"quantitative"
}
,
}
}
)
Insert cell
md
`## Convicted Crimes of Exonerees`
Insert cell
VegaLite
(
{
data
:
{
values
:
data
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
field
:
"Worst Crime Display"
,
type
:
"nominal"
}
,
y
:
{
aggregate
:
"count"
,
field
:
"*"
,
type
:
"quantitative"
}
,
}
}
)
Insert cell
md
` ## Convicted Crime of Exonerees`
Insert cell
VegaLite
(
{
data
:
{
values
:
data
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
field
:
"Worst Crime Display"
,
type
:
"nominal"
}
,
y
:
{
aggregate
:
"count"
,
field
:
"*"
,
type
:
"quantitative"
}
,
}
}
)
Insert cell
md
` ## Exonerees Cleared through DNA`
Insert cell
VegaLite
(
{
data
:
{
values
:
data
}
,
mark
:
"bar"
,
encoding
:
{
x
:
{
bin
:
true
,
field
:
"Age"
,
type
:
"nominal"
}
,
y
:
{
aggregate
:
"count"
,
field
:
"*"
,
type
:
"quantitative"
}
,
color
:
{
field
:
"DNA"
,
type
:
"nominal"
}
}
}
)
Insert cell
md
` ## References`
Insert cell
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
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
dataMinAge
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
VegaLite
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML