This is a useful example for converting a matplotlib linechart to D3 with an initial animation. Using this template, you can quickly generate a dynamic linechart using all of your favorite matplotlib styles, and add more advanced interactions without dealing with a lot of additional formatting.
See linechart.py
for code used to generate linechart.svg
. It generates a simple linechart with some basic formatting. Matplotlib's savefig
function will automatically output an svg format if the filepath has a .svg extension. The key is to assign a unique gid to each line using the gid
parameter, so it is simple to find the lines when you read the svg in index.html
.
This is Part 2 in a series of examples for using matplotlib generated plots in D3.
https://d3js.org/d3.v4.min.js
https://d3js.org/d3-ease.v1.min.js
https://d3js.org/d3-queue.v3.min.js
https://d3js.org/d3-selection.v1.min.js
https://d3js.org/d3-transition.v1.min.js