I have certain boxplots within each state that are statistically significant between two brands.
a4_dims = (40, 10)
fig, ax = pyplot.subplots(figsize=a4_dims)
dd=pd.melt(df_box,id_vars=['region'],value_vars=['Lowe\'s','Home Depot'],var_name='brands')
a = df_box.groupby(['region']).sum()
most_visits_order = a.assign(tmp=a.sum(axis=1)).sort_values('tmp', ascending=False).drop('tmp', 1).index.tolist()
sns.boxplot(x='region',y='value',data=dd,hue='brands',showfliers=False,order=most_visits_order)
How can I highlight or call attention to the states I've found statistical differences in? (say it's TX, GA for example)
I've tried to convert it to a forloop method so I could manually add them for each x but that didn't work out too well:
fig, ax = plt.subplots()
n=len(stat_sig)
fig,ax = plt.subplots(n,1, figsize=(6,n*2), sharex=True,squeeze=False)
for i in range(n):
plt.sca(ax[i])
dd=pd.melt(df_box[df_box['region']==stat_sig[i]],id_vars=['region'],value_vars=['Lowe\'s','Home Depot'],var_name='brands')
ax = sns.boxplot(x='region',y='value',data=dd,hue='brands',width=0.2)
ax.legend_.remove()
plt.show()
Error: TypeError: unhashable type: 'numpy.ndarray'