Unlisted
Edited
Feb 16, 2024
Insert cell
Insert cell
Insert cell
hispanicScatterplot = {
return addTooltips(
Plot.plot({
marginTop: 30,
marginBottom: 50,
marginLeft: 50,
marginRight: 30,
title:
"Comparing percentage of Hispanic FTIC students to percentage point increase from 6-year to 8-year graduation rates.",
// subtitle: "",
caption: caption(
"Data Source: [NCES IPEDS - 2014 Cohort](https://nces.ed.gov/ipeds/use-the-data)"
),
width: Math.max(width, 600),
height: 600,
color: {
legend: false,
scheme: "Cool",
opacity: 1,
reverse: true,
style: { fontSize: "1em" }
},
x: {
percent: false,
grid: true,
label: "Percentage of Hispanic Students",
tickFormat: d3.format("0.0%"),
domain: [0.1, 1] // Set x-axis domain from 0% to 90%
},
y: {
grid: false,
label: "Percentage Point Increase",
domain: [0, 7.2]
},
style: {
font: "bold 11px sans-serif"
},
color: {
domain: [
"Public Independent",
"TAMUS",
"TSUS",
"TTUS",
"TWU",
"UHS",
"UNTS",
"UTS",
"Statewide"
], //, "Professional"],
range: [
"#6a51a3",
"#500000",
"#8e7449",
"#CC0000",
"#E3D353",
"#888b8d",
"#00853E",
"#F47920",
"#2166AC"
],
legend: false
},

marks: [
Plot.dot(noHBCU, {
x: "hispanic_total",
y: "ChangePP",
stroke: "System",
fill: "System",
r: "HispanicC",
title: (d) =>
`${d.University}\n6-Year Rate: ${d3.format("0.0%")(
d.Bach6
)}\n8-Year Rate: ${d3.format("0.0%")(
d.Bach8
)}\nPercentage Point Change: ${d3.format(",")(
d.ChangePP
)}\nPercentage of Hispanic Students: ${d3.format("0.1%")(
d.hispanic_total
)}`
// tip: true
}),
Plot.linearRegressionY(noHBCU, {
x: "hispanic_total",
y: "ChangePP",
ci: 0.89,
stroke: "#600000"
}),
// Plot.text(noHBCU, {
// filter: (d) => d.University === "PVAMU",
// x: "hispanic_total",
// y: "ChangePP",
// fontSize: 12,
// text: (d) => d.University,
// // dx: 8,
// dy: 15
// }),
Plot.text(noHBCU, {
// filter: (d) => d.NonWhiteP >= 0.94,
filter: (d) =>
d.University === "TAMIU" ||
d.University === "TX Southern" ||
d.University === "UTEP" ||
d.University === "UH Downtown" ||
d.University === "UH" ||
d.University === "UNT Dallas" ||
d.University === "TAMUK" ||
d.University === "TWU" ||
d.University === "UTRGV",
x: "hispanic_total",
y: "ChangePP",
fontSize: 12,
fill: "System",
text: (d) => d.University,
// dx: 8,
dy: -15
// dy: (d) => 10 + Math.random() * 10 // Add random vertical offset
// textAnchor: "start",
// align: "left"
// filter: (d, i, data) => {
// const currentLabel = data[i].University;
// const previousLabels = data
// .slice(0, i)
// .map((item) => item.University);
// return !previousLabels.includes(currentLabel);
// }
})
]
})
);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
grad-rate-change-re-finance-pell-admitrate@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
import {caption} from "bae7cbe100f70aa1"
Insert cell
import {html, svg} from "@observablehq/htl"
Insert cell
import {customTickFormat} from "b274db337a3a1d37"
Insert cell
import {round} from "b274db337a3a1d37"
Insert cell
// import {Plot} from "@mkfreeman/plot-tooltip"
Insert cell
import { Plot } from "@observablehq/plot"
Insert cell
import {addTooltips} from "b274db337a3a1d37"
Insert cell
import {hover} from "b274db337a3a1d37"
Insert cell
import {id_generator} from "b274db337a3a1d37"
Insert cell
import { tooltipPlugin } from "b274db337a3a1d37"
Insert cell
Insert cell
html`<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">`
Insert cell
html`<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">`
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more