Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 461da6c

Browse files
committed
Merge pull request #5123 from ericmjl/mep12-errorbar_limits.py
mep12 on errorbar_limits.py
2 parents ee9e046 + c7a6a09 commit 461da6c

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed
Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
1-
'''
1+
"""
22
Illustration of upper and lower limit symbols on errorbars
3-
'''
3+
"""
44

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
87

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)
1211

13-
P.errorbar(x, y, yerr=0.1, capsize=3)
12+
plt.errorbar(x, y, yerr=0.1, capsize=3)
1413

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)
1716

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)
2221

23-
P.xlim(-1, 10)
22+
plt.xlim(-1, 10)
2423

25-
fig = P.figure()
26-
x = arange(10.0)/10.0
24+
fig = plt.figure(1)
25+
x = np.arange(10.0)/10.0
2726
y = (x + 0.1)**2
2827

29-
P.errorbar(x, y, xerr=0.1, xlolims=True)
28+
plt.errorbar(x, y, xerr=0.1, xlolims=True)
3029
y = (x + 0.1)**3
3130

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)
3332

3433
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)
3635

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)
3938

40-
P.show()
39+
plt.show()

0 commit comments

Comments
 (0)