Single Line Plot
A single line plot presents data on x-y axis using a line joining datapoints. To obtain a graph Seaborn comes with an inbuilt function to draw a line plot called lineplot().
Syntax: lineplot(x,y,data)
where,
x– data variable for x-axis
y- data variable for y-axis
data- data to be plotted
Example:
Python3
# import modules import seaborn as sn import matplotlib.pyplot as plt import pandas as pd # import data data = pd.read_csv( "C:\\Users\\Vanshi\\Desktop\\gfg\\bestsellers.csv" ) # selecting required rows and columns data = data.iloc[ 2 : 10 , :] # plotting a single line graph sn.lineplot(x = "Year" , y = "User Rating" , data = data) # displaying the plot plt.show() |
Output:
Data Visualization with Seaborn Line Plot
Prerequisite:
Presenting data graphically to emit some information is known as data visualization. It basically is an image to help a person interpret what the data represents and study it and its nature in detail. Dealing with large scale data row-wise is an extremely tedious task, hence data visualization serves as an ideal alternative.
Seaborn is a Python library which is based on matplotlib and is used for data visualization. It provides a medium to present data in a statistical graph format as an informative and attractive medium to impart some information.
Installation
Like any another python library, seaborn can be easily installed using pip:
pip install seaborn
This library is a part of Anaconda distribution and usually works just by import if your IDE is supported by Anaconda, but it can be installed too by the following command:
conda install seaborn
Contact Us