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 d501818

Browse filesBrowse files
committed
mep12 on log_bar.py
1 parent 7539b61 commit d501818
Copy full SHA for d501818

File tree

Expand file treeCollapse file tree

1 file changed

+11
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-12
lines changed

‎examples/pylab_examples/log_bar.py

Copy file name to clipboard
+11-12Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
#!/usr/bin/env python
2-
3-
from matplotlib import pylab
1+
import matplotlib.pyplot as plt
2+
import numpy as np
43

54
data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1))
65

7-
pylab.xlabel("FOO")
8-
pylab.ylabel("FOO")
9-
pylab.title("Testing")
10-
pylab.gca().set_yscale('log')
6+
plt.xlabel("FOO")
7+
plt.ylabel("FOO")
8+
plt.title("Testing")
9+
plt.gca().set_yscale('log')
1110

1211
dim = len(data[0])
1312
w = 0.75
1413
dimw = w / dim
1514

16-
x = pylab.arange(len(data))
15+
x = np.arange(len(data))
1716
for i in range(len(data[0])):
1817
y = [d[i] for d in data]
19-
b = pylab.bar(x + i * dimw, y, dimw, bottom=0.001)
20-
pylab.gca().set_xticks(x + w / 2)
21-
pylab.gca().set_ylim((0.001, 1000))
18+
b = plt.bar(x + i * dimw, y, dimw, bottom=0.001)
19+
plt.gca().set_xticks(x + w / 2)
20+
plt.gca().set_ylim((0.001, 1000))
2221

23-
pylab.show()
22+
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.