0

I'm trying to visualise a seemingly simple income vs expenses chart in form of stacked bar chart with Observable Plot.

While I can more or less visualise a single dataset, I'm not sure if showing two distinctive datasets together is possible in Plot.

Here's what I need to show on a single chart:

EXPENSES (stacked values on X, name & value text, with large sum on the right)

INCOME (as above)

Stacked bar chart

Additionally, it would be great to have just single ticks with large total value on both bars. Also, is it possible to then draw and calculate the difference somehow (possibly as another bar)?

Here's my attempt.

ALx
  • 611
  • 9
  • 24
  • I've updated my example. Still some text readability issues and I need to find a way to customise colour for different facets but otherwise I'm happy. – ALx Mar 01 '23 at 12:31

1 Answers1

0

You appear to be close already! It looks like you just need to combine your expenses and income into a single data file, and then facet that file on your Y axis:

https://observablehq.com/@observablehq/plot-facets

I haven't gotten all the way there when tinkering, but you clued me in on the faceting. That being said, you'll have a hard time constructing the labels. Also, getting the 'extra' difference bar may be difficult.

aaron.kyle
  • 163
  • 3
  • 10