Draw bar chart in the cell backgrounds. Parameters ---------- subset : label, array-like, IndexSlice, optional A valid 2d input to `DataFrame.loc[<subset>]`, or, in the case of a 1d input or single key, to `DataFrame.loc[:, <subset>]` where t
(
self,
subset: Subset | None = None,
axis: Axis | None = 0,
*,
color: str | list | tuple | None = None,
cmap: Any | None = None,
width: float = 100,
height: float = 100,
align: str | float | Callable = "mid",
vmin: float | None = None,
vmax: float | None = None,
props: str = "width: 10em;",
)
| 3412 | return self.map(lambda x: values, subset=subset) |
| 3413 | |
| 3414 | def bar( |
| 3415 | self, |
| 3416 | subset: Subset | None = None, |
| 3417 | axis: Axis | None = 0, |
| 3418 | *, |
| 3419 | color: str | list | tuple | None = None, |
| 3420 | cmap: Any | None = None, |
| 3421 | width: float = 100, |
| 3422 | height: float = 100, |
| 3423 | align: str | float | Callable = "mid", |
| 3424 | vmin: float | None = None, |
| 3425 | vmax: float | None = None, |
| 3426 | props: str = "width: 10em;", |
| 3427 | ) -> Styler: |
| 3428 | """ |
| 3429 | Draw bar chart in the cell backgrounds. |
| 3430 | |
| 3431 | Parameters |
| 3432 | ---------- |
| 3433 | subset : label, array-like, IndexSlice, optional |
| 3434 | A valid 2d input to `DataFrame.loc[<subset>]`, or, in the case of a 1d input |
| 3435 | or single key, to `DataFrame.loc[:, <subset>]` where the columns are |
| 3436 | prioritised, to limit ``data`` to *before* applying the function. |
| 3437 | axis : {0 or 'index', 1 or 'columns', None}, default 0 |
| 3438 | Apply to each column (``axis=0`` or ``'index'``), to each row |
| 3439 | (``axis=1`` or ``'columns'``), or to the entire DataFrame at once |
| 3440 | with ``axis=None``. |
| 3441 | color : str or 2-tuple/list |
| 3442 | If a str is passed, the color is the same for both |
| 3443 | negative and positive numbers. If 2-tuple/list is used, the |
| 3444 | first element is the color_negative and the second is the |
| 3445 | color_positive (eg: ['#d65f5f', '#5fba7d']). |
| 3446 | cmap : str, matplotlib.cm.ColorMap |
| 3447 | A string name of a matplotlib Colormap, or a Colormap object. Cannot be |
| 3448 | used together with ``color``. |
| 3449 | width : float, default 100 |
| 3450 | The percentage of the cell, measured from the left, in which to draw the |
| 3451 | bars, in [0, 100]. |
| 3452 | height : float, default 100 |
| 3453 | The percentage height of the bar in the cell, centrally aligned, in [0,100]. |
| 3454 | align : str, int, float, callable, default 'mid' |
| 3455 | How to align the bars within the cells relative to a width adjusted center. |
| 3456 | If string must be one of: |
| 3457 | |
| 3458 | - 'left' : bars are drawn rightwards from the minimum data value. |
| 3459 | - 'right' : bars are drawn leftwards from the maximum data value. |
| 3460 | - 'zero' : a value of zero is located at the center of the cell. |
| 3461 | - 'mid' : a value of (max-min)/2 is located at the center of the cell, |
| 3462 | or if all values are negative (positive) the zero is |
| 3463 | aligned at the right (left) of the cell. |
| 3464 | - 'mean' : the mean value of the data is located at the center of the cell. |
| 3465 | |
| 3466 | If a float or integer is given this will indicate the center of the cell. |
| 3467 | |
| 3468 | If a callable should take a 1d or 2d array and return a scalar. |
| 3469 | |
| 3470 | vmin : float, optional |
| 3471 | Minimum bar value, defining the left hand limit |