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

Skip to content

Why does pyplot display wrong grayscale image? #7221

Closed
@ChenZhongPu

Description

@ChenZhongPu
  • matplotlib 1.5.3, python 3.5.1, macos.

I have a grayscale image:

fig2

But plt.inshow displays a wrong image (clearly, it differs from the origin one):

 from PIL import Image
 import matplotlib.pyplot as plt
 import matplotlib.cm as cm
 img = Image.open('...')
 plt.imshow(image, cmap=cm.gray)

download

I have tried Display image as grayscale using matplotlib, but it dose not work still.

My question is: how to display grayscale image correctly using pyplot?

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