|
1 |
| -''' |
| 1 | +""" |
2 | 2 | Illustration of upper and lower limit symbols on errorbars
|
3 |
| -''' |
| 3 | +""" |
4 | 4 |
|
5 |
| -from math import pi |
6 |
| -from numpy import array, arange, sin |
7 |
| -import pylab as P |
| 5 | +import numpy as np |
| 6 | +import matplotlib.pyplot as plt |
8 | 7 |
|
9 |
| -fig = P.figure() |
10 |
| -x = arange(10.0) |
11 |
| -y = sin(arange(10.0)/20.0*pi) |
| 8 | +fig = plt.figure(0) |
| 9 | +x = np.arange(10.0) |
| 10 | +y = np.sin(np.arange(10.0)/20.0*np.pi) |
12 | 11 |
|
13 |
| -P.errorbar(x, y, yerr=0.1, capsize=3) |
| 12 | +plt.errorbar(x, y, yerr=0.1, capsize=3) |
14 | 13 |
|
15 |
| -y = sin(arange(10.0)/20.0*pi) + 1 |
16 |
| -P.errorbar(x, y, yerr=0.1, uplims=True) |
| 14 | +y = np.sin(np.arange(10.0)/20.0*np.pi) + 1 |
| 15 | +plt.errorbar(x, y, yerr=0.1, uplims=True) |
17 | 16 |
|
18 |
| -y = sin(arange(10.0)/20.0*pi) + 2 |
19 |
| -upperlimits = array([1, 0]*5) |
20 |
| -lowerlimits = array([0, 1]*5) |
21 |
| -P.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits) |
| 17 | +y = np.sin(np.arange(10.0)/20.0*np.pi) + 2 |
| 18 | +upperlimits = np.array([1, 0]*5) |
| 19 | +lowerlimits = np.array([0, 1]*5) |
| 20 | +plt.errorbar(x, y, yerr=0.1, uplims=upperlimits, lolims=lowerlimits) |
22 | 21 |
|
23 |
| -P.xlim(-1, 10) |
| 22 | +plt.xlim(-1, 10) |
24 | 23 |
|
25 |
| -fig = P.figure() |
26 |
| -x = arange(10.0)/10.0 |
| 24 | +fig = plt.figure(1) |
| 25 | +x = np.arange(10.0)/10.0 |
27 | 26 | y = (x + 0.1)**2
|
28 | 27 |
|
29 |
| -P.errorbar(x, y, xerr=0.1, xlolims=True) |
| 28 | +plt.errorbar(x, y, xerr=0.1, xlolims=True) |
30 | 29 | y = (x + 0.1)**3
|
31 | 30 |
|
32 |
| -P.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits) |
| 31 | +plt.errorbar(x + 0.6, y, xerr=0.1, xuplims=upperlimits, xlolims=lowerlimits) |
33 | 32 |
|
34 | 33 | y = (x + 0.1)**4
|
35 |
| -P.errorbar(x + 1.2, y, xerr=0.1, xuplims=True) |
| 34 | +plt.errorbar(x + 1.2, y, xerr=0.1, xuplims=True) |
36 | 35 |
|
37 |
| -P.xlim(-0.2, 2.4) |
38 |
| -P.ylim(-0.1, 1.3) |
| 36 | +plt.xlim(-0.2, 2.4) |
| 37 | +plt.ylim(-0.1, 1.3) |
39 | 38 |
|
40 |
| -P.show() |
| 39 | +plt.show() |
0 commit comments