matplotlib examples‎ > ‎Posts‎ > ‎

Plot with x-errorbars and generated line

posted Nov 24, 2010, 1:35 AM by Mart Objartel   [ updated Apr 21, 2011, 5:41 AM ]



from numpy import arange, log
import pylab as plt
import matplotlib as mpl


fig = plt.figure(figsize=(3.54, 3.2))
host = fig.add_subplot(111)

muy = [
0.1,
0.15,
0.2,
0.25,
0.3,
0.35,
0.4,
0.52,
0.54,
]

sx = [
5.668743677,
9.254533132,
14.23590137,
11.87910853,
14.6118157,
16.8120231,
18.58892361,
100.1652558,
443.4712272,
]

er = [
0.986042277,
1.328704279,
0.913025089,
0.997960015,
1.921483929,
4.435,
2.817,
0,
0,
]
#monod


gensub = arange(0, 25, 0.1)
mon = []
for i in arange(0, 25, 0.1):
    monod = 0.2386*log(i)-0.3751
    mon.append(monod)
print mon

plt.subplots_adjust(left=0.19, bottom=0.16, right=0.91)
#par.set_xlabel("monod")

plt.ylabel("$\mu$ (h$^{-1}$)")
plt.xlabel("S ($\mu$M)")

plt.xticks(arange(5, 23, 2))
plt.xlim(4.5, 21.5)

plt.yticks(arange(0.1, 0.5, 0.1))
plt.ylim(0, 0.5)

plt.errorbar(sx, muy, xerr=er, barsabove=True, ls="none", marker="o", mfc="w", color="k")
plt.plot(gensub, mon, ls="dotted", marker="none", mfc="k", color="k")
plt.show()

Comments