Published
Edited
Sep 28, 2019
1 fork
Insert cell
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
data = d3.csv("https://www.sfu.ca/~lha54/exonerees.csv", d3.autoType)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
minYear = d3.min(data, d => d.Convicted)
Insert cell
maxYear = d3.max(data, d => d.Convicted)
Insert cell
Insert cell
Insert cell
sumofAge = data.reduce((sum, d) => sum + (d.Age), 0)
Insert cell
Insert cell
Insert cell
countofFemales = data.filter(d => d.Sex === "Female").reduce((count, d) => count + 1, 0)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
meanYear = d3.mean(data, d => d.Exonerated)
Insert cell
Insert cell
sdYear = d3.deviation(data, d => d.Exonerated)
Insert cell
Insert cell
medYear = d3.median(data, d => d.Exonerated)
Insert cell
Insert cell
Insert cell
sortByYears = d3.nest()
.key(d => d.Exonerated)
.rollup(v => v.length)
.object(data)
Insert cell
import {vl} from '@vega/vega-lite-api'
Insert cell
Insert cell
vl.markBar()
.data(data)
.encode(
vl.x().fieldQ('Age').bin({maxbins: 20}),
vl.y().count()
)
.render()
Insert cell
Insert cell
Insert cell
Insert cell
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
Insert cell
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` The majority of exonerees are Black. This information is proof that the Black community is most often wrongfully convicted for crimes they did not commit, probably due to the racial bias present in the American legal system. Additionally, there are almost no Asians, Native Americans, and persons of other races who are exonerated/wrongfully accused, in comparison.`
Insert cell
Insert cell
VegaLite({
data: {values: data},
mark: "bar",
encoding: {
x:{field: "Sex", type: "nominal"},
y:{aggregate: "count", field: "*", type: "quantitative"},
}
})
Insert cell
Insert cell
Insert cell
VegaLite({
data: {values: data},
mark: "bar",
encoding: {
x:{field: "State", type: "nominal"},
y:{aggregate: "count", field: "*", type: "quantitative"},
}
})

Insert cell
md ` With this chart, it's very easy to distinguish which states have high exoneree counts. There are in California, Illionois, New York and Texas. This could signify a few different things: that these are states that have high overall conviction rates (both correct and false), high number of mistaken accusations, or that these have high populations in general. A quick google search shows that California state has one of the highest number of crimes in the country, making it reasonable that they would have a higher number of exonerees as well do to false judgement.`
Insert cell
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` Murder is incredibly prevalent as a worst crime the exoneree is convicted of even when compared to other common accusations such as drug possession and sexual assault. This could be a sign that it is easier to mistake the culprit of murder and it might be due to difficulty of tracing evidence correctly back to the criminal.`
Insert cell
md` ## Number of Exonerees Convicted over years`
Insert cell
VegaLite({
data: {values: data},
mark: "bar",
encoding: {
x:{field: "Convicted", type: "nominal"},
y:{aggregate: "count", field: "*", type: "quantitative"},
}
})
Insert cell
md` This chart shows that the number of exonerees convited started soaring after 1980s. The number has been fairly high in the 1990s and very stable until a pretty big dip down right before 2000. There has also been a huge decrease in wrongly convicted exonerees after 2015, suggesting that there might have been improvements in preventing it from happening, but also not entirely. The decrease could just be that they haven't been able to prove that a criminal is innocent yet because it takes a few years to figure out. It has only been 4 years since 2015, meaning that data on the count of exonerees is still changing and we will have to wait several more years before we are more certain that the numbers are correct.`
Insert cell
md` ## Number of Exoneration over Years`
Insert cell
VegaLite({
data: {values: data},
mark: "bar",
encoding: {
x:{field: "Exonerated", type: "nominal"},
y:{aggregate: "count", field: "*", type: "quantitative"},
}
})
Insert cell
md` Just as mentioned in the previous graph, there could have been some major improvements in proving the innocent of a wrongly convicted criminal in the more recent years. This could definitely be the reason why there are so many more people that have been proven innocent after 2012.`
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 `The chart above shows the ratio of exonerees who were proven innocent through DNA sampling. Especially in the highest convicted age groups (ages 10-20,20-30, and 30-40), around 1/4th to 1/5th of the exonerees were released from their convictions through DNA as evidence.`
Insert cell
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.
Learn more