Skip to main content
`Ctrl`+`K`

# imshow_norm

astropy.visualization.mpl_normalize.imshow_norm(data, ax=None, **kwargs)

  A convenience function to call matplotlib’s `matplotlib.pyplot.imshow` function, using an `ImageNormalize` object as the normalization.

  Parameters:
    data 2D or 3D numpy:array_like

      The data to show. Can be whatever `imshow` and `ImageNormalize` both accept. See `imshow`.

    ax `python:None` or `Axes`, optional

      If None, use pyplot’s imshow. Otherwise, calls `imshow` method of the supplied axes.

    **kwargs `python:dict`, optional

      All other keyword arguments are parsed first by the `ImageNormalize` initializer, then to `imshow`.

  Returns:
    result `python:tuple`

      A tuple containing the `AxesImage` generated by `imshow` as well as the `ImageNormalize` instance.

  Notes

  The `norm` matplotlib keyword is not supported.

  Examples

      import numpy as np
      import matplotlib.pyplot as plt
      from astropy.visualization import (imshow_norm, MinMaxInterval,
                                         SqrtStretch)

      # Generate and display a test image
      image = np.arange(65536).reshape((256, 256))
      fig = plt.figure()
      ax = fig.add_subplot(1, 1, 1)
      im, norm = imshow_norm(image, ax, origin='lower',
                             interval=MinMaxInterval(),
                             stretch=SqrtStretch())
      fig.colorbar(im)

  (`png`, `svg`, `pdf`)