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

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

New in version 0.17.1.


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


self : Styler


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.

Scroll To Top