Public
Edited
Jun 10
Insert cell
md`# Data for Biostats`
Insert cell
counts_heart = [
{ sex: 0, target: 0, count: 72 },
{ sex: 0, target: 1, count: 25 },
{ sex: 1, target: 0, count: 114 },
{ sex: 1, target: 1, count: 93 }
]
Insert cell
Plot.plot({
title: "Heart Disease by Gender (Relative Frequency)",
x: {
label: "Gender",
tickFormat: d => d === 0 ? "Female" : "Male"
},
y: {
label: "Proportion"
},
color: {
legend: true,
label: "Heart Disease",
domain: [0, 1],
range: ["#a6cee3", "#fb9a99"],
tickFormat: d => d === 0 ? "No Heart Disease" : "Heart Disease"
},
marks: [
Plot.barY(
Plot.groupNormalize("y", Plot.group("sex", Plot.stackY(Plot.barY(data, {
x: d => d.sex,
y: d => d.count,
fill: d => d.target
}))))
)
]
})

Insert cell
workbook = FileAttachment("heart.xlsx").xlsx()
Insert cell
workbook.sheetNames
Insert cell
data = workbook.sheet(0, {
headers: true,
// range: "A1:J10"
})
Insert cell
data
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
workbook1 = FileAttachment("mtl_sit.xlsx").xlsx()
Insert cell
workbook1.sheetNames
Insert cell
data1 = workbook1.sheet(0, {
headers: true,
// range: "A1:J10"
})
Insert cell
data1
Type Table, then Shift-Enter. Ctrl-space for more options.

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