Skip to content

Instantly share code, notes, and snippets.

@razhangwei
Last active April 1, 2019 00:57
Show Gist options
  • Save razhangwei/40d19fb14b8da6b12e48140b8a010181 to your computer and use it in GitHub Desktop.
Save razhangwei/40d19fb14b8da6b12e48140b8a010181 to your computer and use it in GitHub Desktop.
extract and modify data from Figure #matplotlib
# the better practice would be always export your data along with the graph
# maybe in the future when mpld3.fig_to_json() has been greately improved,
# one can simply use this function.
fig = ...
ax = fig.axes[0]
# line
line = ax.lines[0]
line.set_ydata(line.get_ydata() + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment