This message was deleted.
# help
s
This message was deleted.
f
you could use fill: 'difference' and sort by the fill channel:
Copy code
Plot.plot({
  width: 200,
  marks: [
    Plot.barX(clean_monthly_april, {
      y: 'title',
      x: 'activations',
      fill: 'difference',
      sort: {y: 'fill'}
    })
  ]
})
it's not yet possible to sort by an arbitrary channel, please upvote https://github.com/observablehq/plot/issues/867
the recommended pattern for now is to specify the domain:
Copy code
Plot.plot({
  width: 200,
  y: {domain: d3.sort(clean_monthly_april, d => d.difference).map(d => d.title)},
  marks: [
    Plot.barX(clean_monthly_april, {
      y: 'title',
      x: 'activations'
    })
  ]
})
sorry, there is another possiblity that already works:
Copy code
Plot.plot({
  width: 200,
  marks: [
    Plot.barX(clean_monthly_april, {
      y: 'title',
      x: 'activations',
      channels: {difference: {value: 'difference'}},
      sort: {y: 'difference'}
    })
  ]
})
🙏 2
a
Got it, so I have to specify the “channels” channel first. Thanks, @Fil !
f
technically channels is not a channel, it's a mark option that defines extra channels (plural) 🙂 but, yeah 🙂
âś… 1