8000 pylab to plt and np · matplotlib/matplotlib@72989de · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 72989de

Browse files
author
domspad
committed
pylab to plt and np
1 parent 9e6d737 commit 72989de

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed
Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,42 @@
1-
#!/usr/bin/python
2-
3-
#
4-
# Example boxplot code
5-
#
6-
7-
from pylab import *
1+
import matplotlib.pyplot as plt
2+
import numpy as np
83

94
# fake up some data
10-
spread = rand(50) * 100
11-
center = ones(25) * 50
12-
flier_high = rand(10) * 100 + 100
13-
flier_low = rand(10) * -100
14-
data = concatenate((spread, center, flier_high, flier_low), 0)
5+
spread = np.random.rand(50) * 100
6+
center = np.ones(25) * 50
7+
flier_high = np.random.rand(10) * 100 + 100
8+
flier_low = np.random.rand(10) * -100
9+
data = np.concatenate((spread, center, flier_high, flier_low), 0)
1510

1611
# basic plot
17-
boxplot(data)
12+
plt.boxplot(data)
1813

1914
# notched plot
20-
figure()
21-
boxplot(data, 1)
15+
plt.figure()
16+
plt.boxplot(data, 1)
2217

2318
# change outlier point symbols
24-
figure()
25-
boxplot(data, 0, 'gD')
19+
plt.figure()
20+
plt.boxplot(data, 0, 'gD')
2621

2722
# don't show outlier points
28-
figure()
29-
boxplot(data, 0, '')
23+
plt.figure()
24+
plt.boxplot(data, 0, '')
3025

3126
# horizontal boxes
32-
figure()
33-
boxplot(data, 0, 'rs', 0)
27+
plt.figure()
28+
plt.boxplot(data, 0, 'rs', 0)
3429

3530
# change whisker length
36-
figure()
37-
boxplot(data, 0, 'rs', 0, 0.75)
31+
plt.figure()
32+
plt.boxplot(data, 0, 'rs', 0, 0.75)
3833

3934
# fake up some more data
40-
spread = rand(50) * 100
41-
center = ones(25) * 40
42-
flier_high = rand(10) * 100 + 100
43-
flier_low = rand(10) * -100
44-
d2 = concatenate((spread, center, flier_high, flier_low), 0)
35+
spread = np.random.rand(50) * 100
36+
center = np.ones(25) * 40
37+
flier_high = np.random.rand(10) * 100 + 100
38+
flier_low = np.random.rand(10) * -100
39+
d2 = np.concatenate((spread, center, flier_high, flier_low), 0)
4540
data.shape = (-1, 1)
4641
d2.shape = (-1, 1)
4742
#data = concatenate( (data, d2), 1 )
@@ -51,7 +46,7 @@
5146
# a 2-D array into a list of vectors internally anyway.
5247
data = [data, d2, d2[::2, 0]]
5348
# multiple box plots on one figure
54-
figure()
55-
boxplot(data)
49+
plt.figure()
50+
plt.boxplot(data)
5651

57-
show()
52+
plt.show()

0 commit comments

Comments
 (0)
0