Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. from io import BytesIO
  2. import pickle
  3. from matplotlib import pyplot
  4.  
  5. fig = pyplot.plot(.....)
  6.  
  7. sio = BytesIO()
  8. pickle.dump(obj, sio, -1)
  9. sio.seek(0)
  10. binary_to_save = sio.read()
  11.  
  12. with open(figure_path, 'wb') as file:
  13.     file.write(binary_to_save)
  14.  
  15. with open(figure_path, 'rb') as file:
  16.     raw = file.read()
  17.  
  18. figure = pickle.load(BytesIO(raw))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement