Difference between sns.lineplot() and plt.plot (kind = 'line')

Viewed 30

Question: How the two lines of code are different in their outputs?

plt.plot(kind='line', x='date', y='level', data= dam_level)
sns.lineplot(x='date', y='level', data= dam_level)

We have a DataFrame named dam_level having limited number of data. And we are asked to plot the monthly dam level height contained in the dam_level DataFrame. Here is the data

Date Level
2019-01-01 48.6
2019-02-01 48.7
2019-03-01 44.8

Complete Code


import matplotlib.pyplot as plt

import seaborn as sns

plt.plot(kind='line', x='date', y='level', data= dam_level) #results wrong output
sns.lineplot(x='date', y='level', data= dam_level)

plt.xticks(rotation=45)
plt.show()

See Output here

0 Answers
Related