8000 Incorrect Image Tutorial Inline Sample Code · Issue #5900 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Incorrect Image Tutorial Inline Sample Code #5900
Closed
@katzenbaer

Description

@katzenbaer

The inline/inpage sample code under the Array Interpolation schemes heading is incorrect. However, the Source Code linked below the inline code is correct.

For example, see In[20]:

In [20]: imgplot = plt.imshow(resized, interpolation="nearest")

which links to image_tutorial-9.py.

This sample code assumes the users has followed the previous inline sample code:

In [16]: from PIL import Image
In [17]: img = Image.open('../_static/stinkbug.png')
In [18]: resized = img.thumbnail((64, 64), Image.ANTIALIAS) # resizes image in-place
In [19]: imgplot = plt.imshow(img)

As shown on In [18], the thumbnail function resizes the image in-place. This means that resized is an empty variable and cannot be passed into plt.imshow(). The inline sample code should instead follow the downloadable sample code and pass img into plt.imshow().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0