from IPython.display import HTML, Javascript, display
def configure_d3():
"""Tell require where to get d3 from in `require(['d3'])`"""
display(Javascript("""
require.config({
paths: {
d3: "https://d3js.org/d3.v4.min"
}
})"""))
configure_d3()
%%html
<svg id="gohere"></svg>
<script type="text/javascript">
require(['d3'], function (d3) {
var svg = d3.select("#gohere");
var circle = svg.append("circle")
.attr("cx", 100)
.attr("cy", 100)
.attr("r", 40)
.attr("fill", "blue")
.attr("stroke", "black");
});
</script>