python - Updating mpld3 figure with JSON data -



python - Updating mpld3 figure with JSON data -

i've been playing around mpld3 plotting , trying figure out way of updating generated mpld3 plots supplying new json serialized dictionary. let's i've generated mpld3 plot using templating engine:

var json_data = {{ mpld3 json serialized using mpld3.fig_to_dict() }} mpld3.draw_figure("fig01", json_data);

now i've added slider callback meant update entire figure using new json generated using mpld3.fig_to_dict() call. pr on mpld3's github demonstrates how update , animate individual line elements using slider there simple way update entire figure supplying new json data?

it seems best way update entire figure remove , start fresh. in terms of code above:

var json_data = {{ mpld3 json serialized using mpld3.fig_to_dict() }}; d3.select("#fig01").selectall("*").remove(); mpld3.draw_figure("fig01", json_data);

here a little illustration gist.

python d3.js mpld3

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -