So, you have your data in a numpy array (either by importing it, or by generating it). Let's render it. In Matplotlib, this is performed using the imshow() function. Here we'll grab the plot object. This object gives you an easy way to manipulate the plot from the prompt.

imgplot = plt.imshow(img)
Pseudocolor is only relevant to single-channel, grayscale, luminosity images. We currently have an RGB image. Since R, G, and B are all similar (see for yourself above or in your data), we can just pick one channel of our data:

lum_img = img[:, :, 0]

# This is array slicing.  You can read more in the `Numpy tutorial
# <https://numpy.org/doc/stable/user/quickstart.html>`_.

plt.imshow(lum_img)

# Output:
# <matplotlib.image.AxesImage object at 0x7f216cf2a0d0>
Now, with a luminosity (2D, no color) image, the default colormap (aka lookup table, LUT), is applied. The default is called viridis. There are plenty of others to choose from.

plt.imshow(lum_img, cmap="hot")

# Output:
# <matplotlib.image.AxesImage object at 0x7f217caf35b0>
We'll use the Pillow library that we used to load the image also to resize the image.

from PIL import Image

img = Image.open('../../doc/_static/stinkbug.png')
img.thumbnail((64, 64), Image.ANTIALIAS)  # resizes image in-place
imgplot = plt.imshow(img)
Sometimes you want to enhance the contrast in your image, or expand the contrast in a particular region while sacrificing the detail in colors that don't vary much, or don't matter. A good tool to find interesting regions is the histogram. To create a histogram of our image data, we use the hist() function.

plt.hist(lum_img.ravel(), bins=256, range=(0.0, 1.0), fc='k', ec='k')

# Output:
# (array([2.000e+00, 2.000e+00, 3.000e+00, 3.000e+00, 2.000e+00, 2.000e+00,
#        3.000e+00, 1.000e+00, 7.000e+00, 9.000e+00, 7.000e+00, 2.000e+00,
#        7.000e+00, 1.000e+01, 1.100e+01, 1.500e+01, 1.400e+01, 2.700e+01,
#        2.100e+01, 2.400e+01, 1.400e+01, 3.100e+01, 2.900e+01, 2.800e+01,
#        2.400e+01, 2.400e+01, 4.000e+01, 2.600e+01, 5.200e+01, 3.900e+01,
#        5.700e+01, 4.600e+01, 8.400e+01, 7.600e+01, 8.900e+01, 8.000e+01,
#        1.060e+02, 1.130e+02, 1.120e+02, 9.000e+01, 1.160e+02, 1.090e+02,
#        1.270e+02, 1.350e+02, 9.800e+01, 1.310e+02, 1.230e+02, 1.110e+02,
#        1.230e+02, 1.160e+02, 1.010e+02, 1.170e+02, 1.000e+02, 1.010e+02,
#        9.000e+01, 1.060e+02, 1.260e+02, 1.040e+02, 1.070e+02, 1.110e+02,
#        1.380e+02, 1.000e+02, 1.340e+02, 1.210e+02, 1.400e+02, 1.320e+02,
#        1.390e+02, 1.160e+02, 1.330e+02, 1.180e+02, 1.080e+02, 1.170e+02,
#        1.280e+02, 1.200e+02, 1.210e+02, 1.100e+02, 1.160e+02, 1.180e+02,
#        9.700e+01, 9.700e+01, 1.140e+02, 1.070e+02, 1.170e+02, 8.700e+01,
#        1.070e+02, 9.800e+01, 1.040e+02, 1.120e+02, 1.110e+02, 1.180e+02,
#        1.240e+02, 1.340e+02, 1.200e+02, 1.410e+02, 1.520e+02, 1.360e+02,
#        1.610e+02, 1.380e+02, 1.620e+02, 1.570e+02, 1.350e+02, 1.470e+02,
#        1.690e+02, 1.710e+02, 1.820e+02, 1.980e+02, 1.970e+02, 2.060e+02,
#        2.160e+02, 2.460e+02, 2.210e+02, 2.520e+02, 2.890e+02, 3.450e+02,
#        3.620e+02, 3.760e+02, 4.480e+02, 4.630e+02, 5.170e+02, 6.000e+02,
#        6.200e+02, 6.410e+02, 7.440e+02, 7.120e+02, 8.330e+02, 9.290e+02,
#        1.061e+03, 1.280e+03, 1.340e+03, 1.638e+03, 1.740e+03, 1.953e+03,
#        2.151e+03, 2.290e+03, 2.440e+03, 2.758e+03, 2.896e+03, 3.384e+03,
#        4.332e+03, 5.584e+03, 6.197e+03, 6.422e+03, 6.404e+03, 7.181e+03,
#        8.196e+03, 7.968e+03, 7.474e+03, 7.926e+03, 8.460e+03, 8.091e+03,
#        9.148e+03, 8.563e+03, 6.747e+03, 6.074e+03, 6.328e+03, 5.291e+03,
#        6.472e+03, 6.268e+03, 2.864e+03, 3.760e+02, 1.620e+02, 1.180e+02,
#        1.270e+02, 9.500e+01, 7.600e+01, 8.200e+01, 6.200e+01, 6.700e+01,
#        5.600e+01, 5.900e+01, 4.000e+01, 4.200e+01, 3.000e+01, 3.400e+01,
#        3.200e+01, 4.300e+01, 4.200e+01, 2.300e+01, 2.800e+01, 1.900e+01,
#        2.200e+01, 1.600e+01, 1.200e+01, 1.800e+01, 9.000e+00, 1.000e+01,
#        1.700e+01, 5.000e+00, 2.100e+01, 1.300e+01, 8.000e+00, 1.200e+01,
#        1.000e+01, 8.000e+00, 8.000e+00, 5.000e+00, 1.300e+01, 6.000e+00,
#        3.000e+00, 7.000e+00, 6.000e+00, 2.000e+00, 1.000e+00, 5.000e+00,
#        3.000e+00, 3.000e+00, 1.000e+00, 1.000e+00, 1.000e+00, 5.000e+00,
#        0.000e+00, 1.000e+00, 3.000e+00, 0.000e+00, 1.000e+00, 1.000e+00,
#        2.000e+00, 1.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
#        0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
#        0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
#        0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
#        0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
#        0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
#        0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00]), array([0.        , 0.00390625, 0.0078125 , 0.01171875, 0.015625  ,
#        0.01953125, 0.0234375 , 0.02734375, 0.03125   , 0.03515625,
#        0.0390625 , 0.04296875, 0.046875  , 0.05078125, 0.0546875 ,
#        0.05859375, 0.0625    , 0.06640625, 0.0703125 , 0.07421875,
#        0.078125  , 0.08203125, 0.0859375 , 0.08984375, 0.09375   ,
#        0.09765625, 0.1015625 , 0.10546875, 0.109375  , 0.11328125,
#        0.1171875 , 0.12109375, 0.125     , 0.12890625, 0.1328125 ,
#        0.13671875, 0.140625  , 0.14453125, 0.1484375 , 0.15234375,
#        0.15625   , 0.16015625, 0.1640625 , 0.16796875, 0.171875  ,
#        0.17578125, 0.1796875 , 0.18359375, 0.1875    , 0.19140625,
#        0.1953125 , 0.19921875, 0.203125  , 0.20703125, 0.2109375 ,
#        0.21484375, 0.21875   , 0.22265625, 0.2265625 , 0.23046875,
#        0.234375  , 0.23828125, 0.2421875 , 0.24609375, 0.25      ,
#        0.25390625, 0.2578125 , 0.26171875, 0.265625  , 0.26953125,
#        0.2734375 , 0.27734375, 0.28125   , 0.28515625, 0.2890625 ,
#        0.29296875, 0.296875  , 0.30078125, 0.3046875 , 0.30859375,
#        0.3125    , 0.31640625, 0.3203125 , 0.32421875, 0.328125  ,
#        0.33203125, 0.3359375 , 0.33984375, 0.34375   , 0.34765625,
#        0.3515625 , 0.35546875, 0.359375  , 0.36328125, 0.3671875 ,
#        0.37109375, 0.375     , 0.37890625, 0.3828125 , 0.38671875,
#        0.390625  , 0.39453125, 0.3984375 , 0.40234375, 0.40625   ,
#        0.41015625, 0.4140625 , 0.41796875, 0.421875  , 0.42578125,
#        0.4296875 , 0.43359375, 0.4375    , 0.44140625, 0.4453125 ,
#        0.44921875, 0.453125  , 0.45703125, 0.4609375 , 0.46484375,
#        0.46875   , 0.47265625, 0.4765625 , 0.48046875, 0.484375  ,
#        0.48828125, 0.4921875 , 0.49609375, 0.5       , 0.50390625,
#        0.5078125 , 0.51171875, 0.515625  , 0.51953125, 0.5234375 ,
#        0.52734375, 0.53125   , 0.53515625, 0.5390625 , 0.54296875,
#        0.546875  , 0.55078125, 0.5546875 , 0.55859375, 0.5625    ,
#        0.56640625, 0.5703125 , 0.57421875, 0.578125  , 0.58203125,
#        0.5859375 , 0.58984375, 0.59375   , 0.59765625, 0.6015625 ,
#        0.60546875, 0.609375  , 0.61328125, 0.6171875 , 0.62109375,
#        0.625     , 0.62890625, 0.6328125 , 0.63671875, 0.640625  ,
#        0.64453125, 0.6484375 , 0.65234375, 0.65625   , 0.66015625,
#        0.6640625 , 0.66796875, 0.671875  , 0.67578125, 0.6796875 ,
#        0.68359375, 0.6875    , 0.69140625, 0.6953125 , 0.69921875,
#        0.703125  , 0.70703125, 0.7109375 , 0.71484375, 0.71875   ,
#        0.72265625, 0.7265625 , 0.73046875, 0.734375  , 0.73828125,
#        0.7421875 , 0.74609375, 0.75      , 0.75390625, 0.7578125 ,
#        0.76171875, 0.765625  , 0.76953125, 0.7734375 , 0.77734375,
#        0.78125   , 0.78515625, 0.7890625 , 0.79296875, 0.796875  ,
#        0.80078125, 0.8046875 , 0.80859375, 0.8125    , 0.81640625,
#        0.8203125 , 0.82421875, 0.828125  , 0.83203125, 0.8359375 ,
#        0.83984375, 0.84375   , 0.84765625, 0.8515625 , 0.85546875,
#        0.859375  , 0.86328125, 0.8671875 , 0.87109375, 0.875     ,
#        0.87890625, 0.8828125 , 0.88671875, 0.890625  , 0.89453125,
#        0.8984375 , 0.90234375, 0.90625   , 0.91015625, 0.9140625 ,
#        0.91796875, 0.921875  , 0.92578125, 0.9296875 , 0.93359375,
#        0.9375    , 0.94140625, 0.9453125 , 0.94921875, 0.953125  ,
#        0.95703125, 0.9609375 , 0.96484375, 0.96875   , 0.97265625,
#        0.9765625 , 0.98046875, 0.984375  , 0.98828125, 0.9921875 ,
#        0.99609375, 1.        ], dtype=float32), <BarContainer object of 256 artists>)
Note that you can also change colormaps on existing plot objects using the set_cmap() method:

imgplot = plt.imshow(lum_img)
imgplot.set_cmap('nipy_spectral')
You can specify the clim in the call to plot.

imgplot = plt.imshow(lum_img, clim=(0.0, 0.7))
It's helpful to have an idea of what value a color represents. We can do that by adding a color bar to your figure:

imgplot = plt.imshow(lum_img)
plt.colorbar()

# Output:
# <matplotlib.colorbar.Colorbar object at 0x7f217c063ee0>
You can also specify the clim using the returned object

fig = plt.figure()
ax = fig.add_subplot(1, 2, 1)
imgplot = plt.imshow(lum_img)
ax.set_title('Before')
plt.colorbar(ticks=[0.1, 0.3, 0.5, 0.7], orientation='horizontal')
ax = fig.add_subplot(1, 2, 2)
imgplot = plt.imshow(lum_img)
imgplot.set_clim(0.0, 0.7)
ax.set_title('After')
plt.colorbar(ticks=[0.1, 0.3, 0.5, 0.7], orientation='horizontal')

# Output:
# <matplotlib.colorbar.Colorbar object at 0x7f216dd16be0>
Let's try some others. Here's "nearest", which does no interpolation.

imgplot = plt.imshow(img, interpolation="nearest")

Recommend

Matplotlib Image tutorial Importing image data into Numpy arrays

Matplotlib Image tutorial Startup commands

Matplotlib Pyplot tutorial Logarithmic and other nonlinear axes

Matplotlib Pyplot tutorial Working with text Annotating text

Matplotlib Pyplot tutorial Working with text Using mathematical expressions in text

Matplotlib Pyplot tutorial Working with text

Matplotlib Pyplot tutorial Working with multiple figures and axes

Matplotlib Pyplot tutorial Controlling line properties

Matplotlib Pyplot tutorial Plotting with categorical variables

Matplotlib Pyplot tutorial Plotting with keyword strings

Matplotlib Pyplot tutorial Intro to pyplot Formatting the style of your plot

Matplotlib Pyplot tutorial Intro to pyplot

Matplotlib Basic Usage Working with multiple Figures and Axes

Matplotlib Basic Usage Color mapped data

Matplotlib Basic Usage Axis scales and ticks Additional Axis objects

Matplotlib Basic Usage Axis scales and ticks Plotting dates and strings

Matplotlib Basic Usage Axis scales and ticks Tick locators and formatters

Matplotlib Basic Usage Axis scales and ticks Scales

Matplotlib Basic Usage Labelling plots Legends

Matplotlib Basic Usage Labelling plots Annotations

Matplotlib Basic Usage Labelling plots Using mathematical expressions in text

Matplotlib Basic Usage Labelling plots Axes labels and text

Matplotlib Basic Usage Styling Artists Linewidths, linestyles, and markersizes

Matplotlib Basic Usage Styling Artists Colors

Matplotlib Basic Usage Styling Artists

Matplotlib Basic Usage Coding styles Making a helper functions

Matplotlib Basic Usage Coding styles The object-oriented and the pyplot interfaces

Matplotlib Basic Usage Types of inputs to plotting functions

Matplotlib Basic Usage Parts of a Figure Figure

Matplotlib Basic Usage A simple example

Matplotlib Basic Usage

Matplotlib The Lifecycle of a Plot Saving our plot

Matplotlib The Lifecycle of a Plot Combining multiple visualizations

Matplotlib The Lifecycle of a Plot Customizing the plot

Matplotlib The Lifecycle of a Plot Controlling the style

Matplotlib The Lifecycle of a Plot Getting started

Matplotlib The Lifecycle of a Plot Our data

Customizing Matplotlib with style sheets and rcParams The matplotlibrc file The default matplotlibrc file

Customizing Matplotlib with style sheets and rcParams The matplotlibrc file

Customizing Matplotlib with style sheets and rcParams Using style sheets Temporary styling

Customizing Matplotlib with style sheets and rcParams Using style sheets Composing styles

Customizing Matplotlib with style sheets and rcParams Using style sheets Defining your own style

Customizing Matplotlib with style sheets and rcParams Using style sheets

Customizing Matplotlib with style sheets and rcParams Runtime rc settings Temporary rc settings

Customizing Matplotlib with style sheets and rcParams Runtime rc settings

Matplotlib origin and extent in imshow Explicit extent and axes limits

Matplotlib origin and extent in imshow Explicit extent

Matplotlib origin and extent in imshow Default extent

Matplotlib origin and extent in imshow

Matplotlib Autoscaling Working with collections

Matplotlib Autoscaling Controlling autoscale

Matplotlib Autoscaling Sticky edges

Matplotlib Autoscaling Margins

Matplotlib Autoscaling

Matplotlib Constrained Layout Guide Notes on the algorithm Uneven sized Axes

Matplotlib Constrained Layout Guide Notes on the algorithm Colorbar associated with a Gridspec

Matplotlib Constrained Layout Guide Notes on the algorithm Two Axes and colorbar

Matplotlib Constrained Layout Guide Notes on the algorithm Simple case: two Axes

Matplotlib Constrained Layout Guide Notes on the algorithm Simple case: one Axes

Matplotlib Constrained Layout Guide Limitations Incompatible functions

Matplotlib Constrained Layout Guide Manually setting axes positions