-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matplotlib output using pyodide.runPython() #12
Comments
If self-building Pyodide... # Around line 100 on Nov. 4, 2019...
def create_root_element(self):
# Designed to be overridden by subclasses for use in contexts other
# than iodide.
try:
from js import iodide
return iodide.output.element('div')
except ImportError:
return document.createElement('div') If you do create a custom class, be sure to change the initialization code at the end of # Around line 580 on 11/4/19
@_Backend.export
class _BackendWasmCoreAgg(_Backend):
FigureCanvas = FigureCanvasWasm # Change this!
FigureManager = FigureManagerWasm
@staticmethod
def show():
from matplotlib import pyplot as plt
plt.gcf().canvas.show() If unable to modify the source... /**
* Dummy object to act like that used by Iodide.
* Only do this if you need to! Bugs related to
* the successful import of this object might
* appear!
*/
window.iodide =
{
output:
{
// Create a new element with tagName
// and add it to an element with id "root".
element: (tagName) =>
{
let elem = document.createElement(tagName);
document.querySelector("#root").appendChild(elem);
return elem;
}
}
}; |
I hope this is the right place to put this - how do I access the plots made by the matplotlib package? I am using the pyodide package independent of iodide and I don't know how to use the plots made by matplotlib. I have a similar problem to pyodide/pyodide#365 but it never received a response. Thanks in advance!
The text was updated successfully, but these errors were encountered: