如何在 Visual Studio Code 本身中显示图形? [英] How to show graph in Visual Studio Code itself?

查看:188
本文介绍了如何在 Visual Studio Code 本身中显示图形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行此示例时:

When I try to run this example:

import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np

x = np.linspace(0, 20, 100)
plt.plot(x, np.sin(x))
plt.show()

我在新窗口中看到了结果.是否可以在Visual Studio Code本身中查看结果图?

I see the result in a new window. Is it any way to see the result graphs in the Visual Studio Code itself?

推荐答案

是的,如果您使用笔记本界面.基本上,安装 Python 扩展包,它包含 Jupyter 扩展,将您的代码放入编辑器中,将 #%% 放在代码顶部,您将获得 Run cell单击,单击它,您将在另一个窗口中获得结果

Yes, if you use notebook interface. Basically, install Python Extension Pack, it includes Jupyter extension, put your code in the editor, put #%% at the top of your code, you'll get Run cell clickable, click it, and you'll get result in the other window

以下是扩展名的链接: https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter

更新

好的,显然微软聘请了 Don Jayamanne,他正在为 VS Code 开发 Python 和 Jupyter.上个月,他们 (MS) 改进了他们的 python 扩展,以支持 Visual Code 中的 Jupyter notebooks 以及 .ipynb 导入和导出.获取扩展此处并检查

Ok, apparently Microsoft hired Don Jayamanne and he's working on Python and Jupyter for VS Code. And last month they (MS) improved their python extension to support Jupyter notebooks right in the Visual Code together with .ipynb import and export. Get extension here and check blog post how to use it with Jupyter notebooks.

更新二

另一个是神经元,正在开发中,但看起来不错 - 同样是 VS Code 中的笔记本,带有图表、降价等.获取它这里

Another one is Neuron, under development, but looks nice - again, notebooks in VS Code, with graphs, markdown etc. Get it here

这篇关于如何在 Visual Studio Code 本身中显示图形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆