Skip to content

Instantly share code, notes, and snippets.

@andrewgiessel
Created March 28, 2013 14:28
Show Gist options
  • Save andrewgiessel/5263554 to your computer and use it in GitHub Desktop.
Save andrewgiessel/5263554 to your computer and use it in GitHub Desktop.
plot mean +/- SEM in matplotlib
import scipy
def plot_mean_and_sem(array, axis=1):
mean = array.mean(axis=axis)
sem_plus = mean + scipy.stats.sem(array, axis=axis)
sem_minus = mean - scipy.stats.sem(array, axis=axis)
fill_between(np.arange(mean.shape[0]), sem_plus, sem_minus, alpha=0.5)
plot(mean)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment