File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 4
4
convert it to an array and pass it to Pillow for rendering.
5
5
"""
6
6
7
- import pylab
7
+ import matplotlib . pyplot as plt
8
8
from matplotlib .backends .backend_agg import FigureCanvasAgg
9
9
10
+
10
11
try :
11
12
from PIL import Image
12
13
except ImportError :
13
14
raise SystemExit ("PIL must be installed to run this example" )
14
15
15
- pylab .plot ([1 , 2 , 3 ])
16
+ plt .plot ([1 , 2 , 3 ])
16
17
17
- canvas = pylab .get_current_fig_manager ().canvas
18
+ canvas = plt .get_current_fig_manager ().canvas
18
19
19
20
agg = canvas .switch_backends (FigureCanvasAgg )
20
21
agg .draw ()
24
25
l , b , w , h = agg .figure .bbox .bounds
25
26
w , h = int (w ), int (h )
26
27
27
-
28
- X = pylab .fromstring (s , pylab .uint8 )
28
+ X = np .fromstring (s , np .uint8 )
29
29
X .shape = h , w , 3
30
30
31
31
im = Image .fromstring ("RGB" , (w , h ), s )
You can’t perform that action at this time.
0 commit comments