Unlisted
Edited
Oct 30, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mosaic_data = {
let groups = d3.group(data, (o) => o["What is your gender (optional):"]);
let mosaic_data = [];
groups.forEach(function (v, k) {
let sub_groups = d3.group(v, (o) => o["What is your eye color?"]);
sub_groups.forEach(function (vv, kk) {
mosaic_data.push({ x: k, y: kk, value: vv.length });
});
});
return mosaic_data;
}
Insert cell
two_numeric_variables = {
if (two_numeric_variables_selector.length == 2) {
let c1 = data.filter(function (o) {
let x = o[two_numeric_variables_selector[0]];
if (parseFloat(x) && !isNaN(x)) {
return true;
}
});
let c2 = c1.filter(function (o) {
let x = o[two_numeric_variables_selector[1]];
if (parseFloat(x) && !isNaN(x)) {
return true;
}
});
if (c2.length > 0) {
return c2;
}
} else {
return "no_numeric_data";
}
}
Insert cell
numeric_list = data
.map((o) => parseFloat(o[numeric_variable]))
.filter((x) => !isNaN(x))
Insert cell
data = file.csv({ typed: true })
Insert cell
file = {
if (input_file) {
return input_file;
} else {
return selected_file.attachment;
}
}
Insert cell
samples = [
{
name: "American Community Survey",
attachment: FileAttachment("acs12.csv"),
url: "https://www.openintro.org/data/index.php?data=acs12"
},
{
name: "Cherry Blossom Run",
attachment: FileAttachment("run12.csv"),
url: "https://www.openintro.org/data/index.php?data=run17"
},
{
name: "CDC",
attachment: FileAttachment("cdc.csv"),
url: "https://www.openintro.org/book/statdata/?data=cdc"
},
{
name: "70 Year Climate Change",
attachment: FileAttachment("climate70.csv"),
url: "https://www.openintro.org/data/index.php?data=climate70"
},
{
name: "GPA",
attachment: FileAttachment("gpa.csv"),
url: "https://www.openintro.org/data/index.php?data=gpa"
},
{
name: "NBA Players",
attachment: FileAttachment("nba_players_19.csv"),
url: "https://www.openintro.org/data/index.php?data=nba_players_19"
},
{
name: "Bkstr vs Amazon",
attachment: FileAttachment("bkstr_amazon.csv"),
url: "none"
}
// {
// name: "Police use of force in MN",
// attachment: FileAttachment("mn_police_use_of_force.csv"),
// url: "https://www.openintro.org/data/index.php?data=mn_police_use_of_force"
// }
]
Insert cell
cdc_data = samples[2].attachment.csv({ typed: true })
Insert cell
import { boxX, boxY } from "@observablehq/plot-box"
Insert cell
jstat = require("jstat")
Insert cell
ss = require("simple-statistics")
Insert cell
import { rasterize } from "@mbostock/saving-svg"
Insert cell
import { make_mosaic_plot } from "8159a13658589863"
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