Multiple charts one notebook

I’ve been tinkering with the great example of the Gapminder style plots by forking
this notebook. I’d like to be able to plot two charts side by side to show different variables on another chart (as a concrete example, show income vs population) however I’m struggling as something of a novice to see how to implement this and keep it DRY. Any suggestions welcome.

You can use multiple import-with statements to import this chart into your notebook and override the data (or any other cell definition):

Alternatively, you could fork my notebook to wrap the chart cell in a function that you can then call to instantiate the chart with different settings and data.

1 Like

Many thanks Mike I will try both those approaches and see how I get on.

stuwilmur - did you end up implementing this? I have a similar goal and would be nice to learn from your experience. Thank you!

@zanarmstrong Can you describe what you’re attempting to do, or ideally share a notebook link?

@zanarmstrong, sorry for the very delayed reply! I did, thanks to Mike’s help. Please see https://observablehq.com/d/60dcb7fff1532121. Perhaps it will be helpful.