I am trying to plot bar style histograms with multiple classifications as stored in a pandas dataframe. I can get the the histograms to plot using both the methods below, however they cover each other and I'd like to plot them side by side. In the second case, the histtype variable appears to be ignored.
Is there a way to do this using one of the two methods below?
I have tried like this
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
colour = 0
for var in array:
l = [var]
df_array=df.loc[df.var.isin(l) , :]
df_array[v].dropna(inplace=True)
plt3=sns.distplot(df_array[v],label=var,kde=False)
colour += 1
and like this
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
colour = 0
for var in array:
df_array=df.loc[df.var.isin([var]) , :]
df_array[v].dropna(inplace=True)
plt4 = plt.hist(list(df_array[df_array['var'] == var][v]),
histtype = 'bar', stacked = False)
colour += 1