# pandas.core.style.Styler.background_gradient

`Styler.``background_gradient`(cmap='PuBu', low=0, high=0, axis=0, subset=None)

  Color the background in a gradient according to the data in each column (optionally row). Requires matplotlib.

  New in version 0.17.1.

  Parameters:

  cmap: str or colormap

  > matplotlib colormap

  low, high: float

  > compress the range by these values.

  axis: int or str

  > 1 or ‘columns’ for colunwise, 0 or ‘index’ for rowwise

  subset: IndexSlice

  > a valid slice for `data` to limit the style application to

  Returns: | self

  Notes

  Tune `low` and `high` to keep the text legible by not using the entire range of the color map. These extend the range of the data by `low * (x.max() - x.min())` and `high * (x.max() - x.min())` before normalizing.