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

Skip to content

Commit 94b32c4

Browse files
committed
Update some relative paths to follow the new self-consistent approach taken by Numpy's version of plot_directive. relative paths are now relative to the document.
1 parent a205f54 commit 94b32c4

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

doc/users/image_tutorial.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ plot from the prompt.
152152
import matplotlib.pyplot as plt
153153
import matplotlib.image as mpimg
154154
import numpy as np
155-
img = mpimg.imread('_static/stinkbug.png')
155+
img = mpimg.imread('../_static/stinkbug.png')
156156
imgplot = plt.imshow(img)
157157

158158
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
188188
import matplotlib.pyplot as plt
189189
import matplotlib.image as mpimg
190190
import numpy as np
191-
img = mpimg.imread('_static/stinkbug.png')
191+
img = mpimg.imread('../_static/stinkbug.png')
192192
lum_img = img[:,:,0]
193193
plt.imshow(lum_img)
194194

@@ -207,7 +207,7 @@ object:
207207
import matplotlib.pyplot as plt
208208
import matplotlib.image as mpimg
209209
import numpy as np
210-
img = mpimg.imread('_static/stinkbug.png')
210+
img = mpimg.imread('../_static/stinkbug.png')
211211
lum_img = img[:,:,0]
212212
imgplot = plt.imshow(lum_img)
213213
imgplot.set_cmap('hot')
@@ -221,7 +221,7 @@ object:
221221
import matplotlib.pyplot as plt
222222
import matplotlib.image as mpimg
223223
import numpy as np
224-
img = mpimg.imread('_static/stinkbug.png')
224+
img = mpimg.imread('../_static/stinkbug.png')
225225
lum_img = img[:,:,0]
226226
imgplot = plt.imshow(lum_img)
227227
imgplot.set_cmap('spectral')
@@ -245,7 +245,7 @@ do that by adding color bars. It's as easy as one line:
245245
import matplotlib.pyplot as plt
246246
import matplotlib.image as mpimg
247247
import numpy as np
248-
img = mpimg.imread('_static/stinkbug.png')
248+
img = mpimg.imread('../_static/stinkbug.png')
249249
lum_img = img[:,:,0]
250250
imgplot = plt.imshow(lum_img)
251251
imgplot.set_cmap('spectral')
@@ -276,7 +276,7 @@ image data, we use the :func:`~matplotlib.pyplot.hist` function.
276276
import matplotlib.pyplot as plt
277277
import matplotlib.image as mpimg
278278
import numpy as np
279-
img = mpimg.imread('_static/stinkbug.png')
279+
img = mpimg.imread('../_static/stinkbug.png')
280280
lum_img = img[:,:,0]
281281
plt.hist(lum_img.flatten(), 256, range=(0.0,1.0), fc='black', ec='black')
282282

@@ -300,7 +300,7 @@ object.
300300
import numpy as np
301301
fig = plt.figure()
302302
a=fig.add_subplot(1,2,1)
303-
img = mpimg.imread('_static/stinkbug.png')
303+
img = mpimg.imread('../_static/stinkbug.png')
304304
lum_img = img[:,:,0]
305305
imgplot = plt.imshow(lum_img)
306306
a.set_title('Before')
@@ -343,7 +343,7 @@ and the computer has to draw in pixels to fill that space.
343343
import matplotlib.image as mpimg
344344
import numpy as np
345345
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
347347
rsize = img.resize((img.size[0]/10,img.size[1]/10)) # resize the image
348348
rsizeArr = np.asarray(rsize)
349349
lum_img = rsizeArr[:,:,0]
@@ -364,7 +364,7 @@ Let's try some others:
364364
import matplotlib.image as mpimg
365365
import numpy as np
366366
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
368368
rsize = img.resize((img.size[0]/10,img.size[1]/10)) # resize the image
369369
rsizeArr = np.asarray(rsize)
370370
lum_img = rsizeArr[:,:,0]
@@ -381,7 +381,7 @@ Let's try some others:
381381
import matplotlib.image as mpimg
382382
import numpy as np
383383
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
385385
rsize = img.resize((img.size[0]/10,img.size[1]/10)) # resize the image
386386
rsizeArr = np.asarray(rsize)
387387
lum_img = rsizeArr[:,:,0]

0 commit comments

Comments
 (0)