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 8db6f68

Browse filesBrowse files
committed
Merge pull request #4818 from ericmjl/mep12_logo.py
Mep12 logo.py
2 parents 7539b61 + e77f12c commit 8db6f68
Copy full SHA for 8db6f68

File tree

Expand file treeCollapse file tree

1 file changed

+20
-18
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-18
lines changed

‎examples/pylab_examples/logo.py

Copy file name to clipboard
+20-18Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
#!/usr/bin/env python
2-
# This file generates the matplotlib web page logo
1+
# This file generates an old version of the matplotlib logo
32

43
from __future__ import print_function
5-
from pylab import *
4+
# Above import not necessary for Python 3 onwards. Recommend taking this
5+
# out in examples in the future, since we should all move to Python 3.
6+
import matplotlib.pyplot as plt
7+
import numpy as np
68
import matplotlib.cbook as cbook
79

810
# convert data to mV
911
datafile = cbook.get_sample_data('membrane.dat', asfileobj=False)
1012
print('loading', datafile)
1113

12-
x = 1000*0.1*fromstring(open(datafile, 'rb').read(), float32)
14+
x = 1000 * 0.1 * np.fromstring(open(datafile, 'rb').read(), np.float32)
1315
# 0.0005 is the sample interval
14-
t = 0.0005*arange(len(x))
15-
figure(1, figsize=(7, 1), dpi=100)
16-
ax = subplot(111, axisbg='y')
17-
plot(t, x)
18-
text(0.5, 0.5, 'matplotlib', color='r',
19-
fontsize=40, fontname=['Courier', 'Bitstream Vera Sans Mono'],
20-
horizontalalignment='center',
21-
verticalalignment='center',
22-
transform=ax.transAxes,
23-
)
24-
axis([1, 1.72, -60, 10])
25-
setp(gca(), 'xticklabels', [])
26-
setp(gca(), 'yticklabels', [])
16+
t = 0.0005 * np.arange(len(x))
17+
plt.figure(1, figsize=(7, 1), dpi=100)
18+
ax = plt.subplot(111, axisbg='y')
19+
plt.plot(t, x)
20+
plt.text(0.5, 0.5, 'matplotlib', color='r',
21+
fontsize=40, fontname=['Courier', 'Bitstream Vera Sans Mono'],
22+
horizontalalignment='center',
23+
verticalalignment='center',
24+
transform=ax.transAxes,
25+
)
26+
plt.axis([1, 1.72, -60, 10])
27+
plt.gca().set_xticklabels([])
28+
plt.gca().set_yticklabels([])
2729

28-
show()
30+
plt.show()

0 commit comments

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