def plot_hist(x, p=5): # Plot the distribution and mark the mean plt.hist(x, alpha=.5) plt.axvline(x.mean()) # 95% confidence interval plt.axvline(np.percentile(x, p/2.), color='red', linewidth=3) plt.axvline(np.percentile(x, 100-p/2.), color='red', linewidth=3) def plot_dists(a, b, nbins, a_label='pop_A', b_label='pop_B', p=5): # Create a single sequence of bins to be shared across both # distribution plots for visualization consistency. combined = pd.concat([a, b]) breaks = np.linspace( combined.min(), combined.max(), num=nbins+1)