Continue drawing upon an SVG created in a different cell

Note that there’s a difference between d3.select("svg") (with quotes, which selects the first svg element on the page) and d3.select(svg) (without quotes, which selects the element referenced by the svg variable). I believe you want the latter in this case.

Also, apologies for the self-promotion, but you might be interested in this notebook I made which demonstrates how to use two chess-related libraries in Observable:

1 Like