Pylab plot with Errorbars Example

From MallWiki

Jump to: navigation, search
from pylab import *

# results for Fall 08 class in CogLab free recall experiment

means = (85.44444, 80.55556, 78.0, 75.22222, 72.44444, 	71.0, 70.0, 71.333336, 72.0, 73.77778)
stds = (13.913463, 14.845934, 14.064688, 16.833813, 17.849197, 16.821877, 17.55272, 18.464605, 22.425436, 20.716604)
N = 60
stderrs = stds / sqrt(N)

positions = range(1,11)

errorbar(positions, means, yerr=stderrs)
axis([0, 11, 0.0, 100.0])
xticks(range(1, 11))
xlabel("Position")
ylabel("Proportion Correct")
show()


# global results in Fall 08 in CogLab free recall experiment

means = (81.3962, 77.52807, 74.30564, 70.549095, 67.736275, 65.111244, 66.00462, 67.50833, 70.425255, 	71.88814)

stds = (16.05654, 16.82955, 17.553984, 18.252888, 18.773695, 19.787886, 20.396795, 21.562986, 22.318378, 22.322233)

N = 9798
stderrs = stds / sqrt(N)

positions = range(1,11)

errorbar(positions, means, yerr=stderrs)
axis([0, 11, 0.0, 100.0])
xticks(range(1, 11))
xlabel("Position")
ylabel("Proportion Correct")
show()