Skip to main content
`Ctrl`+`K`

# LinearStretch

class astropy.visualization.LinearStretch(slope=1, intercept=0)

  Bases: `BaseStretch`

  A linear stretch with a slope and offset.

  The stretch is given by:

  \[y = slope * x + intercept\]
  Parameters:
    slope `python:float`, optional

      The `slope` parameter used in the above formula. Default is 1.

    intercept `python:float`, optional

      The `intercept` parameter used in the above formula. Default is 0.

  Examples

  (`Source code`, `png`, `svg`, `pdf`)

  Attributes Summary

  `inverse` | A stretch object that performs the inverse operation.

  Methods Summary

  `__call__`(values[, clip, out]) | Transform values using this stretch.

  Attributes Documentation

  inverse

    A stretch object that performs the inverse operation.

  Methods Documentation

  __call__(values, clip=True, out=None)

    Transform values using this stretch.

    Parameters:
      values numpy:array_like

        The input values, which should already be normalized to the [0:1] range.

      clip bool, optional

        If `True` (default), values outside the [0:1] range are clipped to the [0:1] range.

      out `ndarray`, optional

        If specified, the output values will be placed in this array (typically used for in-place calculations).

    Returns:
      result `ndarray`

        The transformed values.