Extract data from mpld3 dynamic portion in python

I would like to update the input used to create the mpld3-generated python matplotlib graph list. In fact, I have the same question as here:

Get information about points after dragging

I am familiar with python and matplotlib. sjp14051 responded to the above message, showing how to generate changes to the changes in the coordinates of the points that move within the generated html-graph. Could you explain how the coordinate change created using javascript can be transferred back to the python environment to update the original list of input points [0] used to generate the graph?

(If necessary, please combine this with reference to the SO question).

+2
source share
1 answer

Here is an example of the average size of data retrieval from mpld3 , which I use to place calls on graphs . A simple approach to getting data is to place it in the prompt browser:

function save_callouts(callouts) { function callout_py(d) { return "plt.text(" + dx + ", " + dy + ", '" + ds + "', va='center')\n" + "plt.plot([" + d.x1 + ", " + d.x2 + "], [" + d.y1 + ", " + d.y2 + "], 'k-')\n" } prompt("Copy code to generate callouts:", callouts.map(callout_py).join("\n")); }

There may be easier ways to accomplish this, but prompt , followed by copy and paste on the user part, does the job.

+2
source

All Articles