Skip to content

Instantly share code, notes, and snippets.

@joferkington
Created January 6, 2015 21:38
Show Gist options
  • Save joferkington/bbadb22da6949a285f95 to your computer and use it in GitHub Desktop.
Save joferkington/bbadb22da6949a285f95 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
import cPickle as pickle
def main():
fig, ax = plt.subplots()
ax.plot(range(10))
ax.bar(range(10), range(10))
fig2 = copy_figure(fig)
fig2.axes[0].plot(range(10)[::-1], color='red')
plt.show()
def copy_figure(fig):
return pickle.loads(pickle.dumps(fig, pickle.HIGHEST_PROTOCOL))
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment