📜  Google Colab-图形输出

📅  最后修改于: 2020-10-16 02:36:04             🧑  作者: Mango


Colab还支持丰富的输出,例如图表。在“代码”单元格中键入以下代码。

import numpy as np
from matplotlib import pyplot as plt

y = np.random.randn(100)
x = [x for x in range(len(y))]

plt.plot(x, y, '-')
plt.fill_between(x, y, 200, where = (y > 195), facecolor='g', alpha=0.6)

plt.title("Sample Plot")
plt.show()

现在,如果您运行代码,您将看到以下输出-

图形输出

请注意,图形输出显示在“代码”单元的“输出”部分中。同样,您将能够在整个程序代码中创建和显示几种类型的图表。

现在,当您熟悉Colab的基础知识时,让我们继续学习Colab的功能,这些功能使您的Python代码开发更加容易。