English 中文(简体)
Google Colab - Graphical Outputs
  • 时间:2024-10-18

Google Colab - Graphical Outputs


Previous Page Next Page  

Colab also supports rich outputs such as charts. Type in the following code in the Code cell.


import numpy as np
from matplotpb 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()

Now, if you run the code, you will see the following output −

Graphical Outputs

Note that the graphical output is shown in the output section of the Code cell. Likewise, you will be able to create and display several types of charts throughout your program code.

Now, as you have got famipar with the basics of Colab, let us move on to the features in Colab that makes your Python code development easier.

Advertisements