-
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.
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
datato limit the style application toReturns: self : Styler
Notes
Tune
lowandhighto keep the text legible by not using the entire range of the color map. These extend the range of the data bylow * (x.max() - x.min())andhigh * (x.max() - x.min())before normalizing.
Styler.background_gradient()
2025-01-10 15:47:30
Please login to continue.