Overall Data Structure

Code
import { aq, op } from '@uwdata/arquero'
species_filt = aq.table(serengeti)
  .filter(aq.escape(r => op.includes(SpeciesInput, r.Species)))
  .reify()
Code
spec_counts = species_filt
  .groupby("Species")
  .rollup({
    count: d => op.count()
  })
  .orderby('Species')

Plot.plot({
  marks: [
    Plot.barY(spec_counts, {x: "Species", y: "count"})
  ],
  width: 786,
  marginLeft: 75,
  marginBottom: 100, 
  x: { tickRotate: 90 }
})
Code

// Create checkbox of species
viewof SpeciesInput = Inputs.checkbox(
  speciesList["Species"].sort(),
  { value: speciesList["Species"].sort(),
    label: "Species to include:"
  }
)