Seaborn: Overlaying a box plot or mean with error bars on a histogram
<p>I am creating a histogram in Seaborn of my data in a pretty standard way, ie:</p>

<pre><code>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')
</code></pre>

<p>This produces the following output: <img src="http://i.stack.imgur.com/QPfRW.png" alt="standard histogram."></p>

<p>I also want to visualize the mean + standard deviation of this dataset on the same plot, ideally by having a point for the mean on the x-axis (or right above the x-axis) and notched error bars showing the standard deviation. Another option is a boxplot hugging the x-axis. I tried just adding the line which is commented out (sns.boxplot()), but it looks super ugly and not at all what I'm looking for. Any suggestions?</p>

<p>The boxplot is drawn on a categorical axis and won't coexist nicely with the density axis of the histogram, but it's possible to do it with a twin x axis plot:</p>

<pre><code>import numpy as np
import seaborn as sns

x = np.random.randn(300)
ax = sns.distplot(x)
ax2 = ax.twinx()
sns.boxplot(x=x, ax=ax2)
ax2.set(ylim=(-.5, 10))
</code></pre>

<p><a href="http://i.stack.imgur.com/pTTvg.png" rel="nofollow"><img src="http://i.stack.imgur.com/pTTvg.png" alt="enter image description here"></a></p>

python matplotlib histogram data-visualization seaborn