I have 15 features as X_1, X_2,....., X_15 and I want to create 15 different kde plots.
but when I use the following code, I get all plots in one graph.
for i in range(1,16):
ax = sns.kdeplot(data = train["X_" + str(i)], shade = True)
plt.title('X' + str(i))
Output: https://i.sstatic.net/HZn2I.png
I think you just have to be slightly more explicit about initializing a new Figure
:
for i in range(1,16):
plt.figure()
ax = sns.kdeplot(data = train["X_" + str(i)], shade=True)
plt.title('X' + str(i))
Or
for i in range(1,16):
fig, ax = plt.subplot()
sns.kdeplot(data = train["X_" + str(i)], ax=ax, shade=True)
ax.set_title('X' + str(i))