Skip to content

Commit 00bd7d3

Browse files
attack68JulianWgs
authored andcommitted
update styler user guide for text_gradient (pandas-dev#41661)
1 parent a12ffa0 commit 00bd7d3

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

doc/source/user_guide/style.ipynb

+19-5
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,8 @@
10121012
" - [.highlight_min][minfunc] and [.highlight_max][maxfunc]: for use with identifying extremeties in data.\n",
10131013
" - [.highlight_between][betweenfunc] and [.highlight_quantile][quantilefunc]: for use with identifying classes within data.\n",
10141014
" - [.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",
10161017
" \n",
10171018
"The individual documentation on each function often gives more examples of their arguments.\n",
10181019
"\n",
@@ -1022,6 +1023,7 @@
10221023
"[betweenfunc]: ../reference/api/pandas.io.formats.style.Styler.highlight_between.rst\n",
10231024
"[quantilefunc]: ../reference/api/pandas.io.formats.style.Styler.highlight_quantile.rst\n",
10241025
"[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",
10251027
"[barfunc]: ../reference/api/pandas.io.formats.style.Styler.bar.rst"
10261028
]
10271029
},
@@ -1098,14 +1100,14 @@
10981100
"cell_type": "markdown",
10991101
"metadata": {},
11001102
"source": [
1101-
"### Background Gradient"
1103+
"### Background Gradient and Text Gradient"
11021104
]
11031105
},
11041106
{
11051107
"cell_type": "markdown",
11061108
"metadata": {},
11071109
"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."
11091111
]
11101112
},
11111113
{
@@ -1120,19 +1122,31 @@
11201122
"df2.style.background_gradient(cmap=cm)"
11211123
]
11221124
},
1125+
{
1126+
"cell_type": "code",
1127+
"execution_count": null,
1128+
"metadata": {},
1129+
"outputs": [],
1130+
"source": [
1131+
"df2.style.text_gradient(cmap=cm)"
1132+
]
1133+
},
11231134
{
11241135
"cell_type": "markdown",
11251136
"metadata": {},
11261137
"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",
11281139
"\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"
11301142
]
11311143
},
11321144
{
11331145
"cell_type": "markdown",
11341146
"metadata": {},
11351147
"source": [
1148+
"### Set properties\n",
1149+
"\n",
11361150
"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."
11371151
]
11381152
},

0 commit comments

Comments
 (0)