As we know, a line plot shows the relationship between two variables. We can use the seaborn.lineplot() function to plot a line plot in the seaborn Python library.
Let’s read the flights dataset from the seaborn library. The dataset contains various information, such as year, month, number of passengers, etc. In this article, we will plot a line plot between the number of passengers and the year.
We can use the following Python code for plotting the line plot using the seaborn Python library.
import seaborn from matplotlib import pyplot df = seaborn.load_dataset("flights") print(df.info()) seaborn.lineplot(data=df, x="year", y="passengers") pyplot.show()
The resulting line plot will look like the following:






0 Comments