Skip to content

Commit 4c12d81

Browse files
pelsontacaswell
authored andcommitted
Merge pull request matplotlib#3981 from blink1073/webagg-save-fixes
Fixes for File Saving in Webagg
1 parent a68e2a9 commit 4c12d81

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/matplotlib/backends/backend_webagg.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import datetime
1919
import errno
20-
import io
2120
import json
2221
import os
2322
import random
@@ -197,7 +196,7 @@ def get(self, fignum, fmt):
197196

198197
self.set_header('Content-Type', mimetypes.get(fmt, 'binary'))
199198

200-
buff = io.BytesIO()
199+
buff = six.BytesIO()
201200
manager.canvas.print_figure(buff, format=fmt)
202201
self.write(buff.getvalue())
203202

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ def get_javascript(cls, stream=None):
404404
for filetype, ext in sorted(FigureCanvasWebAggCore.
405405
get_supported_filetypes_grouped().
406406
items()):
407-
extensions.append(ext[0])
407+
if not ext[0] == 'pgf': # pgf does not support BytesIO
408+
extensions.append(ext[0])
408409
output.write("mpl.extensions = {0};\n\n".format(
409410
json.dumps(extensions)))
410411

0 commit comments

Comments
 (0)