@@ -152,7 +152,7 @@ plot from the prompt.
152
152
import matplotlib.pyplot as plt
153
153
import matplotlib.image as mpimg
154
154
import numpy as np
155
- img = mpimg.imread('_static/stinkbug.png')
155
+ img = mpimg.imread('../ _static/stinkbug.png')
156
156
imgplot = plt.imshow(img)
157
157
158
158
You can also plot any numpy array - just remember that the datatype
@@ -188,7 +188,7 @@ This is array slicing. You can read more in the `Numpy tutorial <http://www.sci
188
188
import matplotlib.pyplot as plt
189
189
import matplotlib.image as mpimg
190
190
import numpy as np
191
- img = mpimg.imread('_static/stinkbug.png')
191
+ img = mpimg.imread('../ _static/stinkbug.png')
192
192
lum_img = img[:,:,0]
193
193
plt.imshow(lum_img)
194
194
@@ -207,7 +207,7 @@ object:
207
207
import matplotlib.pyplot as plt
208
208
import matplotlib.image as mpimg
209
209
import numpy as np
210
- img = mpimg.imread('_static/stinkbug.png')
210
+ img = mpimg.imread('../ _static/stinkbug.png')
211
211
lum_img = img[:,:,0]
212
212
imgplot = plt.imshow(lum_img)
213
213
imgplot.set_cmap('hot')
@@ -221,7 +221,7 @@ object:
221
221
import matplotlib.pyplot as plt
222
222
import matplotlib.image as mpimg
223
223
import numpy as np
224
- img = mpimg.imread('_static/stinkbug.png')
224
+ img = mpimg.imread('../ _static/stinkbug.png')
225
225
lum_img = img[:,:,0]
226
226
imgplot = plt.imshow(lum_img)
227
227
imgplot.set_cmap('spectral')
@@ -245,7 +245,7 @@ do that by adding color bars. It's as easy as one line:
245
245
import matplotlib.pyplot as plt
246
246
import matplotlib.image as mpimg
247
247
import numpy as np
248
- img = mpimg.imread('_static/stinkbug.png')
248
+ img = mpimg.imread('../ _static/stinkbug.png')
249
249
lum_img = img[:,:,0]
250
250
imgplot = plt.imshow(lum_img)
251
251
imgplot.set_cmap('spectral')
@@ -276,7 +276,7 @@ image data, we use the :func:`~matplotlib.pyplot.hist` function.
276
276
import matplotlib.pyplot as plt
277
277
import matplotlib.image as mpimg
278
278
import numpy as np
279
- img = mpimg.imread('_static/stinkbug.png')
279
+ img = mpimg.imread('../ _static/stinkbug.png')
280
280
lum_img = img[:,:,0]
281
281
plt.hist(lum_img.flatten(), 256, range=(0.0,1.0), fc='black', ec='black')
282
282
@@ -300,7 +300,7 @@ object.
300
300
import numpy as np
301
301
fig = plt.figure()
302
302
a=fig.add_subplot(1,2,1)
303
- img = mpimg.imread('_static/stinkbug.png')
303
+ img = mpimg.imread('../ _static/stinkbug.png')
304
304
lum_img = img[:,:,0]
305
305
imgplot = plt.imshow(lum_img)
306
306
a.set_title('Before')
@@ -343,7 +343,7 @@ and the computer has to draw in pixels to fill that space.
343
343
import matplotlib.image as mpimg
344
344
import numpy as np
345
345
import Image
346
- img = Image.open('_static/stinkbug.png') # opens the file using PIL - it's not an array yet
346
+ img = Image.open('../ _static/stinkbug.png') # opens the file using PIL - it's not an array yet
347
347
rsize = img.resize((img.size[0]/10,img.size[1]/10)) # resize the image
348
348
rsizeArr = np.asarray(rsize)
349
349
lum_img = rsizeArr[:,:,0]
@@ -364,7 +364,7 @@ Let's try some others:
364
364
import matplotlib.image as mpimg
365
365
import numpy as np
366
366
import Image
367
- img = Image.open('_static/stinkbug.png') # opens the file using PIL - it's not an array yet
367
+ img = Image.open('../ _static/stinkbug.png') # opens the file using PIL - it's not an array yet
368
368
rsize = img.resize((img.size[0]/10,img.size[1]/10)) # resize the image
369
369
rsizeArr = np.asarray(rsize)
370
370
lum_img = rsizeArr[:,:,0]
@@ -381,7 +381,7 @@ Let's try some others:
381
381
import matplotlib.image as mpimg
382
382
import numpy as np
383
383
import Image
384
- img = Image.open('_static/stinkbug.png') # opens the file using PIL - it's not an array yet
384
+ img = Image.open('../ _static/stinkbug.png') # opens the file using PIL - it's not an array yet
385
385
rsize = img.resize((img.size[0]/10,img.size[1]/10)) # resize the image
386
386
rsizeArr = np.asarray(rsize)
387
387
lum_img = rsizeArr[:,:,0]
0 commit comments