Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from io import BytesIO
- import pickle
- from matplotlib import pyplot
- fig = pyplot.plot(.....)
- sio = BytesIO()
- pickle.dump(obj, sio, -1)
- sio.seek(0)
- binary_to_save = sio.read()
- with open(figure_path, 'wb') as file:
- file.write(binary_to_save)
- with open(figure_path, 'rb') as file:
- raw = file.read()
- figure = pickle.load(BytesIO(raw))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement