Retrieve Data From Dynamic mpld3 plot in python

北慕城南 提交于 2019-12-06 05:02:00

Here is a medium-sized example of retrieving data from an mpld3 plot that I use to place call-outs on graphs. The simple approach to getting the data is to put it in a browser prompt:

function save_callouts(callouts) { function callout_py(d) { return "plt.text(" + d.x + ", " + d.y + ", '" + d.s + "', 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 might be slicker ways to accomplish this, but prompt followed by copy-and-paste on the user's part gets the job done.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!