Answers for "matplotlib figure to base64"

1

save matplotlib figure with base64

import cStringIO
my_stringIObytes = cStringIO.StringIO()
plt.savefig(my_stringIObytes, format='jpg')
my_stringIObytes.seek(0)
my_base64_jpgData = base64.b64encode(my_stringIObytes.read())
Posted by: Guest on April-22-2021

Browse Popular Code Answers by Language