
Line Chart –
To create a line chart in seaborn, you can use the relplot() function by setting kind=’line’ or use the lineplot() function.
Let’s read a dataset to illustrate it.
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
url = 'https://raw.githubusercontent.com/bprasad26/lwd/master/data/stocks.csv'
df = pd.read_csv(url, parse_dates=['Date'])
df.drop('Unnamed: 0', axis=1, inplace=True)
df.head()

sns.relplot() –
To create a line plot with relplot() function, you need to pass the x and y values and the dataframe. Let’s plot the Date on x-axis and Open on Y-axis.
sns.relplot(x='Date', y='Open', kind='line', data=df[df['Symbol']=='AAPL']);

To create a multiple line chart we can use the hue parameter of the relplot() function.
sns.relplot(x='Date', y='Open', hue='Symbol', kind='line', data=df);

You can also change the style of the lines using the style parameter.
sns.relplot(x='Date', y='Open', hue='Symbol', style='Symbol', kind='line', data=df)

You can also auto format the x-axis tick labels like this.
g = sns.relplot(x='Date', y='Open', hue='Symbol',
style='Symbol', kind='line', data=df)
g.figure.autofmt_xdate()

You can plot multiple subplots using the col parameter.
g = sns.relplot(x='Date', y='Open', hue='Symbol', col='Symbol',
style='Symbol', kind='line', data=df)
g.figure.autofmt_xdate()

You can also use the row parameter if you want each subplots on top of each others.
g = sns.relplot(x='Date', y='Open', hue='Symbol', row='Symbol',
style='Symbol', kind='line', data=df)
g.figure.autofmt_xdate()

lineplot() –
You can also use the lineplot function to plot a line chart in seaborn.
sns.lineplot(x='Date', y='Open', data=df[df['Symbol']=='AAPL'])

You can also use the hue parameter to create multiple line charts.
sns.lineplot(x='Date', y='Open', hue='Symbol', data=df)
