London Lives Petitions in Sessions Papers, page counts by year, 1690-1799
// direct import instead of rdata =FileAttachment("data/llpp_pets_pgcounts_year_exob_v1-2.tsv").tsv({typed:true})
Plot.plot({width: width,height:600,marginBottom:60,x: {tickRotate:90,tickFormat: d3.format('d')},y: { grid:true,percent:true },color: {legend:true,domain: ["petitions","other"],range: ["#b24747","#47b2b2"] },marks: [ Plot.barY(data, {x:"year",y:"pages",fill:"dtype",order:"dtype",// i think this fixes the random problem.offset:"normalize",tip:true,// need to format year againtip: {format: {x: (d) =>`${d}` } }//sort: {y: "x"} }),//Plot.ruleX([0]) ]})//"#b24747", "#d35400", 1), // orange//"#47b2b2", "#16a085", 1), // turquoise// problem that ptype were randomly ordered!// could fix it by uncounting the data in r and then using count in Plot. but dn't want that sort of faff// order: option seems to fix it.
Notes
Documents can have multiple pages. Excludes OB.
Data: London Lives petitions project, v1.2
Dataviz: Observable Plot (supersedes earlier versions in dimple.js)