python - Seaborn: Overlaying a box plot or mean with error bars on a histogram -


i creating histogram in seaborn of data in pretty standard way, ie:

rc = {'font.size': 32, 'axes.labelsize': 28.5, 'legend.fontsize': 32.0,      'axes.titlesize': 32, 'xtick.labelsize': 31, 'ytick.labelsize': 12} sns.set(style="ticks", color_codes=true, rc = rc) plt.figure(figsize=(25,20),dpi=300)  ax = sns.distplot(syndata['synergy_score']) print (np.mean(syndata['synergy_score']), np.std(syndata['synergy_score'])) # ax = sns.boxplot(syndata['synergy_score'], orient = 'h')   ax.set(xlabel = 'synergy score', ylabel = 'frequency', title = 'aggregate synergy score distribution') 

this produces following output: standard histogram.

i want visualize mean + standard deviation of dataset on same plot, ideally having point mean on x-axis (or right above x-axis) , notched error bars showing standard deviation. option boxplot hugging x-axis. tried adding line commented out (sns.boxplot()), looks super ugly , not @ i'm looking for. suggestions?

the boxplot drawn on categorical axis , won't coexist nicely density axis of histogram, it's possible twin x axis plot:

import numpy np import seaborn sns  x = np.random.randn(300) ax = sns.distplot(x) ax2 = ax.twinx() sns.boxplot(x=x, ax=ax2) ax2.set(ylim=(-.5, 10)) 

enter image description here


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -