matplotlib-pyodide icon indicating copy to clipboard operation
matplotlib-pyodide copied to clipboard

Matplotlib does not work

Open Martmists-GH opened this issue 3 years ago • 4 comments

🐛 Bug

Matplotlib does not render plots

To Reproduce

  1. go to https://pyodide.org/en/latest/console.html
  2. run the following:
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> plt.plot(np.sin(np.linspace(0, 0.05, 200) * np.pi * 2 * 100))
[<matplotlib.lines.Line2D object at 0x1fc7878>]
>>> plt.show()
>>>

Expected behavior

The plot shows up, either inline or as popup

Environment

  • Pyodide Version: latest
  • Browser version: Google Chrome, 96.0.4664.93 (Official Build) (64-bit)

Martmists-GH avatar Dec 13 '21 10:12 Martmists-GH

The console does not support that, you should use for example: JupyterLite.

oeway avatar Dec 13 '21 15:12 oeway

I'd prefer not to use jupyter for embedding though

Martmists-GH avatar Dec 13 '21 15:12 Martmists-GH

I agree we should add an example with matplotlib (related pyodide/pyodide#1498 ).

Adding support for matplotlib to the REPL is another matter, personally, I don't think it would be in the scope of Pyodide (unless someone can demonstrate that it would be very easy to do). We would rather keep the REPL simple, and leave this work to other projects.

rth avatar Dec 14 '21 20:12 rth

I think it could be fun to have a more fully featured repl at some point, maybe in a separate repo inside of the pyodide org. But yeah, console.html shouldn't get very complicated. I think that jqueryterminal does have support for echoing html and will render it in a reasonable way, so it is possible that this could be done without too much extra complexity.

hoodmane avatar Dec 14 '21 20:12 hoodmane