Public
Edited
Apr 4, 2023
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
height: 600,
x : {
domain: [0, 10],
label: "Number of internal links →"
},
marks: [
Plot.dotX(roc, Plot.dodgeY({x: d => d.internal_links_html, title: d => d.title, fill: d => "steelblue", fillOpacity: 0.5, stroke: "steelblue"})),
]
})
Insert cell
roc_internal_html = roc.filter(d => d.internal_links_html == 0).length
Insert cell
fwc_internal_html = fwc.filter(d => d.internal_links_html == 0).length
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
height: 300,
x: {
domain: [0, 10],
label: "Proportion of adjectives in content (%) →"
},
y: {
domain: [0, 10],
label: "Proportion of adverbs in content (%) →"
},
marks: [
Plot.dot(roc, {x: d => d.pos_prop_ADJ*100, y: d => d.pos_prop_ADV*100, fill: d => "steelblue", fillOpacity: 0.5, stroke: "steelblue"}),
Plot.dot(fwc, {x: d => d.pos_prop_ADJ*100, y: d => d.pos_prop_ADV*100, fill: d => "orange", fillOpacity: 0.5, stroke: "orange"}),
Plot.ruleX([0]),
Plot.ruleY([0]),
]
})
Insert cell
Insert cell
Plot.plot({
height: 300,
x : {
domain: [0, 40],
label: "Average sentence length →"
},
marks: [
Plot.ruleX([Math.round(fwc_asl_avg)], {stroke: "black", strokeOpacity: 0.25, strokeWidth: 2, strokeDasharray: [2,2]}),
Plot.dotX(roc, Plot.dodgeY({x: d => d.sentence_length_mean, title: d => d.title, fill: d => d.sentence_length_mean > 25 ? "red" : d.sentence_length_mean > 15 ? "orange" : "green", fillOpacity: 0.5, stroke: d => d.sentence_length_mean > 25 ? "red" : d.sentence_length_mean > 15 ? "orange" : "green"})),
]
})
Insert cell
Plot.plot({
height: 300,
x : {
domain: [1, 2],
label: "Average sentence length →"
},
marks: [
Plot.dotX(roc, Plot.dodgeY({x: d => d.syllables_per_token_mean, title: d => d.title, fill: d => "steelblue", fillOpacity: 0.5, stroke: "steelblue"})),
Plot.dotX(fwc, Plot.dodgeY({x: d => d.syllables_per_token_mean, title: d => d.title, fill: d => "orange", fillOpacity: 0.5, stroke: "orange"})),
]
})
Insert cell
Plot.plot({
height: 300,
x : {
label: "Title length →",
domain: [0,100]
},
marks: [
Plot.dotX(roc, Plot.dodgeY({x: d => d.title_length, title: d => d.title, fill: d => "steelblue", fillOpacity: 0.5, stroke: "steelblue"})),
Plot.ruleX([70], {stroke: "black", strokeOpacity: 0.25, strokeWidth: 2, strokeDasharray: [2,2]})
]
})
Insert cell
Insert cell
Plot.plot({
height: 300,
x : {
label: "Description length →",
domain: [0,400]
},
marks: [
Plot.dotX(roc, Plot.dodgeY({x: d => d.description_length, title: d => d.title, fill: d => "steelblue", fillOpacity: 0.5, stroke: "steelblue"})),
Plot.ruleX([160], {stroke: "black", strokeOpacity: 0.25, strokeWidth: 2, strokeDasharray: [2,2]})
]
})
Insert cell
Insert cell
Plot.plot({
height: 300,
x : {
domain: [0, 20],
label: "Number of tables →"
},
marks: [
Plot.dotX(wave.filter(d => parseInt(d.table_layout) > 0), Plot.dodgeY({x: d => d.table_layout, fill: d => "steelblue", fillOpacity: 0.5, stroke: "steelblue"})),
]
})
Insert cell
tl = d3.flatRollup(wave, v => v.length, d => d.table_layout)
Insert cell
Plot.plot({
y: {
grid: true,
label: "Items",
},
x : {
label: "Number of tables →"
},
marks: [
Plot.barY(tl.filter(d => d[0] > 0), {x: d => d[0], y: d => d[1], fill: "steelblue"}),
Plot.ruleY([0])
]
})
Insert cell
Insert cell
Plot.plot({
height: 400,
y: {
grid: true
},
x : {
label: "Number of headings skipped →",
},
marks: [
Plot.barY(wave, Plot.binX({y: "count"}, {x: "heading_skipped", fill: "steelblue"})),
]
})
Insert cell
fwc = FileAttachment("fwc_basic_audit@1.csv").csv()
Insert cell
fwc_re_avg = d3.mean(fwc, d => d.flesch_reading_ease)
Insert cell
roc_re_avg = d3.mean(roc, d => d.flesch_reading_ease)
Insert cell
fwc_passive_avg = Math.round(d3.mean(fwc, d => d.prop_passive_sents * 100))
Insert cell
fwc_formality_avg = Math.round(d3.mean(fwc, d => d.formality))
Insert cell
fwc_tokens_avg = Math.round(d3.mean(fwc, d => d.n_tokens))
Insert cell
fwc_1000 = fwc.filter(d => d.n_tokens >= 1000).length
Insert cell
roc_tokens_avg = Math.round(d3.mean(roc, d => d.n_tokens))
Insert cell
fwc_li_avg = Math.round(d3.mean(fwc.filter(d => d.prop_li < 0.76), d => d.prop_li * 100))
Insert cell
roc_li_avg = Math.round(d3.mean(roc.filter(d => d.prop_li < 0.76), d => d.prop_li * 100))
Insert cell
fwc_asl_avg = d3.mean(fwc, d => d.sentence_length_mean)
Insert cell
fwc_asw_avg = d3.mean(fwc, d => d.syllables_per_token_mean)
Insert cell
roc = FileAttachment("basic_audit@5.csv").csv()
Insert cell
roc_passive_avg = Math.round(d3.mean(roc, d => d.prop_passive_sents * 100))
Insert cell
roc_asw_avg = d3.mean(roc, d => d.syllables_per_token_mean)
Insert cell
roc_asl_avg = d3.mean(roc, d => d.sentence_length_mean)
Insert cell
roc_short_d = roc.filter(d => d.description_length < 30).length
Insert cell
wave = FileAttachment("wave.csv").csv();
Insert cell
wave.map(w => {
w["heading_skipped"] = w["heading_skipped"]=="" ? 0 : Number(w["heading_skipped"]);
w["table_layout"] = w["table_layout"]=="" ? 0 : Number(w["table_layout"]);
return w;
});
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