如何通过jupyter_客户端获取matplotlib内联输出
我尝试使用jupyter_客户端获取matplotlib输出,并将其显示在我的web应用程序中。这就是我所做的。但是io.stdout只是一个字符串。如何获取matplotlib的实际图像数据。谢谢如何通过jupyter_客户端获取matplotlib内联输出,matplotlib,ipython,jupyter,Matplotlib,Ipython,Jupyter,我尝试使用jupyter_客户端获取matplotlib输出,并将其显示在我的web应用程序中。这就是我所做的。但是io.stdout只是一个字符串。如何获取matplotlib的实际图像数据。谢谢 In [6]: with capture_output() as io: ...: reply = kc.execute_interactive("import matplotlib.pyplot as plt\n%matplotlib inline\ndata=[1,1,2,3,4]
In [6]: with capture_output() as io:
...: reply = kc.execute_interactive("import matplotlib.pyplot as plt\n%matplotlib inline\ndata=[1,1,2,3,4]\nplt.figure()\nplt.plot(data)", timeout=TI
...: MEOUT)
...:
...:
In [8]: io.stdout
Out[8]: '[<matplotlib.lines.Line2D at 0x1086a8d30>]<matplotlib.figure.Figure at 0x106f220f0>'
[6]中的:将capture_output()作为io:
…:reply=kc.execute\u interactive(“导入matplotlib.pyplot作为plt\n%matplotlib内联\n数据=[1,1,2,3,4]\nplt.figure()\nplt.plot(数据)”,超时=TI
…:MEOUT)
...:
...:
在[8]中:io.stdout
Out[8]:“[]”
也许你会花更多的话在你想要实现的目标上。“在我的应用程序中”有点不具体,不知道您希望在何处以及如何准确显示matplotlib输出。这是一个web应用程序,我想我应该使用与jupyter笔记本相同的方法在该web应用程序上显示图像