|
1012 | 1012 | " - [.highlight_min][minfunc] and [.highlight_max][maxfunc]: for use with identifying extremeties in data.\n",
|
1013 | 1013 | " - [.highlight_between][betweenfunc] and [.highlight_quantile][quantilefunc]: for use with identifying classes within data.\n",
|
1014 | 1014 | " - [.background_gradient][bgfunc]: a flexible method for highlighting cells based or their, or other, values on a numeric scale.\n",
|
1015 |
| - " - [.bar][barfunc]: to display mini-charts within cell backgrounds.\n", |
| 1015 | + " - [.text_gradient][textfunc]: similar method for highlighting text based on their, or other, values on a numeric scale.\n", |
| 1016 | + " - [.bar][barfunc]: to display mini-charts within cell backgrounds.\n", |
1016 | 1017 | " \n",
|
1017 | 1018 | "The individual documentation on each function often gives more examples of their arguments.\n",
|
1018 | 1019 | "\n",
|
|
1022 | 1023 | "[betweenfunc]: ../reference/api/pandas.io.formats.style.Styler.highlight_between.rst\n",
|
1023 | 1024 | "[quantilefunc]: ../reference/api/pandas.io.formats.style.Styler.highlight_quantile.rst\n",
|
1024 | 1025 | "[bgfunc]: ../reference/api/pandas.io.formats.style.Styler.background_gradient.rst\n",
|
| 1026 | + "[textfunc]: ../reference/api/pandas.io.formats.style.Styler.text_gradient.rst\n", |
1025 | 1027 | "[barfunc]: ../reference/api/pandas.io.formats.style.Styler.bar.rst"
|
1026 | 1028 | ]
|
1027 | 1029 | },
|
|
1098 | 1100 | "cell_type": "markdown",
|
1099 | 1101 | "metadata": {},
|
1100 | 1102 | "source": [
|
1101 |
| - "### Background Gradient" |
| 1103 | + "### Background Gradient and Text Gradient" |
1102 | 1104 | ]
|
1103 | 1105 | },
|
1104 | 1106 | {
|
1105 | 1107 | "cell_type": "markdown",
|
1106 | 1108 | "metadata": {},
|
1107 | 1109 | "source": [
|
1108 |
| - "You can create \"heatmaps\" with the `background_gradient` method. These require matplotlib, and we'll use [Seaborn](https://stanford.edu/~mwaskom/software/seaborn/) to get a nice colormap." |
| 1110 | + "You can create \"heatmaps\" with the `background_gradient` and `text_gradient` methods. These require matplotlib, and we'll use [Seaborn](https://stanford.edu/~mwaskom/software/seaborn/) to get a nice colormap." |
1109 | 1111 | ]
|
1110 | 1112 | },
|
1111 | 1113 | {
|
|
1120 | 1122 | "df2.style.background_gradient(cmap=cm)"
|
1121 | 1123 | ]
|
1122 | 1124 | },
|
| 1125 | + { |
| 1126 | + "cell_type": "code", |
| 1127 | + "execution_count": null, |
| 1128 | + "metadata": {}, |
| 1129 | + "outputs": [], |
| 1130 | + "source": [ |
| 1131 | + "df2.style.text_gradient(cmap=cm)" |
| 1132 | + ] |
| 1133 | + }, |
1123 | 1134 | {
|
1124 | 1135 | "cell_type": "markdown",
|
1125 | 1136 | "metadata": {},
|
1126 | 1137 | "source": [
|
1127 |
| - "[.background_gradient][bgfunc] has a number of keyword arguments to customise the gradients and colors. See its documentation.\n", |
| 1138 | + "[.background_gradient][bgfunc] and [.text_gradient][textfunc] have a number of keyword arguments to customise the gradients and colors. See the documentation.\n", |
1128 | 1139 | "\n",
|
1129 |
| - "[bgfunc]: ../reference/api/pandas.io.formats.style.Styler.background_gradient.rst" |
| 1140 | + "[bgfunc]: ../reference/api/pandas.io.formats.style.Styler.background_gradient.rst\n", |
| 1141 | + "[textfunc]: ../reference/api/pandas.io.formats.style.Styler.text_gradient.rst" |
1130 | 1142 | ]
|
1131 | 1143 | },
|
1132 | 1144 | {
|
1133 | 1145 | "cell_type": "markdown",
|
1134 | 1146 | "metadata": {},
|
1135 | 1147 | "source": [
|
| 1148 | + "### Set properties\n", |
| 1149 | + "\n", |
1136 | 1150 | "Use `Styler.set_properties` when the style doesn't actually depend on the values. This is just a simple wrapper for `.applymap` where the function returns the same properties for all cells."
|
1137 | 1151 | ]
|
1138 | 1152 | },
|
|
0 commit comments