Matplotlib: Line Plot

Line Plot can be created in python using Matplotlib's pyplot library. Line plot is used to represent the relation between two data on different axis. It can be used in the same way as bar plot. We can also have multiple lines in a line chart, change color, change type of line and much more.

Import the required libraries

import matplotlib.pyplot as plt
import numpy as np

Create data for plotting the points.

plt.plot(x,label='x-axis', linestyle = 'dotted')
plt.plot(y,label='y-axis',linestyle = 'dashed')



Tue, 11/23/2021 - 09:25

Authored by

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.