Create a Sine Graph using Matplotlib in Python

thumbnail

In this tutorial, you will learn to create a sine graph using matplotlib in python. Before you start you need to import matplotlib and numpy first. The code to import is show below.

import matplotlib.pyplot as plt
import numpy as np

The source code to show sine graph is show below.

x = np.arange(0,10,0.2)
y = np.sin(x)
plt.plot(x,y)
plt.legend(['Sine'])
plt.title('Sine Graph')
plt.show()

The result will be:

Back To Top