Skip to main content

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



Submitted by devanshi.srivastava on November 23, 2021

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


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.