Thanks Thomas, is there any sample code that I can refer ?
在 2017年7月10日星期一 UTC+8下午3:56:27,takowl写道: > > Hi Jeff, > > I think the output_hook parameter to execute_interactive() is what you > want. Here's the docs: > > http://jupyter-client.readthedocs.io/en/latest/api/client.html#jupyter_client.BlockingKernelClient.execute_interactive > > Thomas > > > On 9 July 2017 at 13:37, Jeff Zhang <[email protected] <javascript:>> > wrote: > >> >> I try to use jupyter_client to get the matplotlib output and display it >> in my app. Here's what I did. But io.stdout is just a string. How can I get >> the actual image data of matplotlib. Thanks >> >> >> 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>' >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Project Jupyter" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jupyter/3332cdec-b938-495e-821a-86132ac31749%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jupyter/3332cdec-b938-495e-821a-86132ac31749%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/86470caf-2fb8-4cad-9504-4c40d21006ce%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
