|
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 |
3 | 2 |
|
4 | 3 | 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 |
6 | 8 | import matplotlib.cbook as cbook |
7 | 9 |
|
8 | 10 | # convert data to mV |
9 | 11 | datafile = cbook.get_sample_data('membrane.dat', asfileobj=False) |
10 | 12 | print('loading', datafile) |
11 | 13 |
|
12 | | -x = 1000*0.1*fromstring(open(datafile, 'rb').read(), float32) |
| 14 | +x = 1000 * 0.1 * np.fromstring(open(datafile, 'rb').read(), np.float32) |
13 | 15 | # 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([]) |
27 | 29 |
|
28 | | -show() |
| 30 | +plt.show() |
0 commit comments