I need to plot two graphs side by side. Here the column in my dataset which I am interested in.
X
1
53
12
513
135
125
21
54
1231
I did
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
mean = df['X'].mean()
fig, ax =plt.subplots(1,2)
sns.displot(df, x="X", kind="kde", ax=ax[0]) # 1st plot
plt.axvline(mean, color='r', linestyle='--') # this add just a line on the previous plot, corresponding to the mean of X data
sns.boxplot(y="X", data=df, ax=ax[2]) # 2nd plot
but I have this error: IndexError: index 2 is out of bounds for axis 0 with size 2
, so the use of subplots is wrong.