Skip to content

Commit fa2e492

Browse files
committed
mep12 on logo.py
1 parent 7539b61 commit fa2e492

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

examples/pylab_examples/logo.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
#!/usr/bin/env python
21
# This file generates the matplotlib web page logo
32

4-
from __future__ import print_function
5-
from pylab import *
3+
# from __future__ import print_function
4+
# Above import not necessary for Python 3 onwards. Recommend taking this out in all examples.
5+
import matplotlib.pyplot as plt
6+
import numpy as np
67
import matplotlib.cbook as cbook
78

89
# convert data to mV
910
datafile = cbook.get_sample_data('membrane.dat', asfileobj=False)
1011
print('loading', datafile)
1112

12-
x = 1000*0.1*fromstring(open(datafile, 'rb').read(), float32)
13+
x = 1000*0.1*np.fromstring(open(datafile, 'rb').read(), np.float32)
1314
# 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',
15+
t = 0.0005*np.arange(len(x))
16+
plt.figure(1, figsize=(7, 1), dpi=100)
17+
ax = plt.subplot(111, axisbg='y')
18+
plt.plot(t, x)
19+
plt.text(0.5, 0.5, 'matplotlib', color='r',
1920
fontsize=40, fontname=['Courier', 'Bitstream Vera Sans Mono'],
2021
horizontalalignment='center',
2122
verticalalignment='center',
2223
transform=ax.transAxes,
2324
)
24-
axis([1, 1.72, -60, 10])
25-
setp(gca(), 'xticklabels', [])
26-
setp(gca(), 'yticklabels', [])
25+
plt.axis([1, 1.72, -60, 10])
26+
plt.setp(plt.gca(), 'xticklabels', [])
27+
plt.setp(plt.gca(), 'yticklabels', [])
2728

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

0 commit comments

Comments
 (0)