Google Colab - Graphical Outputs

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

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")

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 familiar with the basics of Colab, let us move on to the features in Colab that makes your Python code development easier.