I create the following plots within a for loop:
cat_var={}
categories=['symboling','fuel-type','make']
for x in categories:
cat_var[x]=df[x].unique()
for key in cat_var.keys():
plt.figure(figsize=(10,10))
for value in cat_var[key]:
subset= df[df[key] == value]
sns.distplot(subset['price'], hist = False, kde = True,kde_kws = {'linewidth': 3},label = value)
plt.legend(prop={'size': 16}, title = key)
plt.title('Price distribution per %s level'% key)
plt.xlabel('Price')
plt.ylabel('Density')
plt.show()
It is working, but I would like to plot them so they appear all on the same row, whereas now I have them all on the same column. I was thinking about using something like:
fig, axes = plt.subplots(1, 3,figsize=(20,20))
but this does not produce the desired output wherever I put this last line of code.
Any thoughts?
