Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a3d4af0

Browse files
committed
Merge pull request #4641 from ericmjl/mep12-to_numeric.py
MEP12 on to_numeric.py
2 parents 3ec9cee + efc1dc2 commit a3d4af0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/pylab_examples/to_numeric.py renamed to examples/pylab_examples/agg_buffer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
convert it to an array and pass it to Pillow for rendering.
55
"""
66

7-
import pylab
7+
import matplotlib.pyplot as plt
88
from matplotlib.backends.backend_agg import FigureCanvasAgg
99

10+
1011
try:
1112
from PIL import Image
1213
except ImportError:
1314
raise SystemExit("PIL must be installed to run this example")
1415

15-
pylab.plot([1, 2, 3])
16+
plt.plot([1, 2, 3])
1617

17-
canvas = pylab.get_current_fig_manager().canvas
18+
canvas = plt.get_current_fig_manager().canvas
1819

1920
agg = canvas.switch_backends(FigureCanvasAgg)
2021
agg.draw()
@@ -24,8 +25,7 @@
2425
l, b, w, h = agg.figure.bbox.bounds
2526
w, h = int(w), int(h)
2627

27-
28-
X = pylab.fromstring(s, pylab.uint8)
28+
X = np.fromstring(s, np.uint8)
2929
X.shape = h, w, 3
3030

3131
im = Image.fromstring("RGB", (w, h), s)

0 commit comments

Comments
 (0)