Public
Edited
Jun 21, 2024
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
tippy = require("tippy.js")
Insert cell
tippy_style = html`<div style="display: hidden">
<link rel="stylesheet" href="${await require.resolve(
`tippy.js/themes/light-border.css`
)}"></div>`
Insert cell
import { Swatches } from "@d3/color-legend"
Insert cell
Insert cell
grouped_data = ({
children: d3
.rollups(
data_to_group,
function (a) {
let group = a[0].division;
let student_cnt = d3.sum(a, (o) => parseInt(o.EnrollmentCurrent));
let value = Math.sqrt(student_cnt);
let course = a[0].Course;
let title = a[0].Prefix == "FYS" ? "First Year Seminar" : a[0].Title;
let section_cnt = a.length;
let instructors = _.uniq(a.map((o) => o.Instructors));
return {
group,
value,
instructors,
course,
title,
section_cnt,
student_cnt
};
},
(o) => o.division,
(o) => o.Course
)
.map((a) => a[1])
.map((a) => ({ children: a.map((aa) => aa[1]) }))
})
Insert cell
data_to_group = prefix == "All" ? data : data.filter((o) => o.Prefix == prefix)
Insert cell
prefixes = _.uniq(data.map((o) => o.Prefix))
Insert cell
data = {
let data = await FileAttachment("courses_fall2023.csv").csv();
data.forEach(function (d) {
d.level = 100 * parseInt(d.Code.slice(-7, -6));
d.Course = d.Code.split(".")[0];
d.Prefix = d.Code.split(" ")[0];
d.division = prefix_to_division.get(d.Prefix);
});
delete data.columns;

return data;
}
Insert cell
prefix_to_division = d3.rollup(
dept_info,
(a) => a[0][2],
(o) => o[1]
)
Insert cell
dept_info = [
["Accounting", "ACCT", "NS"],
["Africana Studies", "AFST", "IS"],
["American Indian and Indigenous Studies", "AIIS", "IS"],
["Ancient Mediterranean Studies", "AMS", "HUM"],
["Anthropology", "ANTH", "SS"],
["Art", "ART", "HUM"],
["Art History", "ARTH", "HUM"],
["Arts", "ARTS", "HUM"],
["Arts Management and Entrepreneurship", "AME", "IS"],
["Asian Studies", "ASIA", "IS"],
["Astronomy", "ASTR", "NS"],
["Atmospheric Sciences", "ATMS", "NS"],
["Biology", "BIOL", "NS"],
["Chemistry", "CHEM", "NS"],
["Cherokee", "CHER", "SS"],
["Climate Change and Society", "CCS", "IS"],
["Computer Science", "CSCI", "NS"],
["Dance", "DAN", "HUM"],
["Drama", "DRAM", "HUM"],
["Economics", "ECON", "NS"],
["Education", "EDUC", "SS"],
["Engineering", "ENGR", "ENGR"],
["General Engineering", "E", "ENGR"],
["Electrical and Computer Engineering", "ECE", "ENGR"],
["Joint Engineering-Mechatronics", "JEM", "ENGR"],
["Mechanical and Aerospace Engineering", "MAE", "ENGR"],
["Material Science and Engineering", "MSE", "ENGR"],
["English", "ENG", "SS"],
["Environmental and Cultural Sustainability", "ECS", "IS"],
["Environmental Studies", "ENVR", "SS"],
["Ethics and Social Institutions", "ESI", "IS"],
["First-Year Studies", "FYS", "HUM"],
["French", "FREN", "SS"],
["German", "GERM", "SS"],
["Health and Wellness", "HW", "SS"],
["Health and Wellness Promotion", "HWP", "SS"],
["History", "HIST", "SS"],
["Honors", "HON", "IS"],
["Human Rights Studies", "HRST", "IS"],
["Humanities", "HUM", "HUM"],
["Interdisciplinary Studies", "IST", "IS"],
["International Studies", "INTS", "IS"],
["Language", "LANG", "HUM"],
["Languages and Literatures", "LL", "HUM"],
["Legal Studies", "LEGL", "IS"],
["Liberal Arts", "LA", "HUM"],
["Literature", "LIT", "HUM"],
["Management", "MGMT", "NS"],
["Mass Communication", "MCOM", "SS"],
["Master of Liberal Arts and Sciences", "MLAS", "HUM"],
["Mathematics", "MATH", "NS"],
["Music", "MUSC", "HUM"],
["Neuroscience", "NEUR", "NS"],
["New Media", "NM", "NS"],
["Philosophy", "PHIL", "HUM"],
["Physics", "PHYS", "NS"],
["Political Science", "POLS", "SS"],
["Portuguese", "PORT", "SS"],
["Psychology", "PSYC", "SS"],
["Religious Studies", "RELS", "SS"],
["Sociology", "SOC", "SS"],
["Spanish", "SPAN", "SS"],
["Statistics", "STAT", "NS"],
["Study Abroad", "SABR", "IS"],
["U.S. Ethnic Studies", "ETHN", "IS"],
["Visual Media Production", "VMP", "NS"],
["Women, Gender and Sexuality Studies", "WGSS", "SS"],
["World Languages", "WLNG", "SS"],

["Business", "BUS", "SS"],
["Greek", "GRK", "SS"],
["Latin", "LAT", "SS"],
["Hebrew", "HEB", "SS"],
["Applied Social Science", "SSCI", "SS"]
]
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