mirror of https://github.com/pyodide/pyodide.git
21 lines
859 B
Diff
21 lines
859 B
Diff
diff -ur matplotlib-2.2.2/lib/matplotlib/figure.py matplotlib-2.2.2/lib/matplotlib/figure.py
|
|
--- a/lib/matplotlib/figure.py 2018-03-05 23:47:09.000000000 -0500
|
|
+++ b/lib/matplotlib/figure.py 2018-05-17 10:46:52.355306452 -0400
|
|
@@ -420,6 +420,17 @@
|
|
from matplotlib.backends import backend_webagg
|
|
return backend_webagg.ipython_inline_display(self)
|
|
|
|
+ def _repr_html_(self):
|
|
+ from js import document
|
|
+ import io
|
|
+ import base64
|
|
+ png_data = io.BytesIO()
|
|
+ self.savefig(png_data, format='png')
|
|
+ img = document.createElement('img')
|
|
+ img.src = 'data:image/png;base64,' + \
|
|
+ base64.b64encode(png_data.getvalue()).decode('ascii')
|
|
+ return img
|
|
+
|
|
def show(self, warn=True):
|
|
"""
|
|
If using a GUI backend with pyplot, display the figure window.
|