Skip to content

Commit

Permalink
tabulator gradients (#7291)
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp Rudiger <prudiger@anaconda.com>
  • Loading branch information
MarcSkovMadsen and philippjfr authored Sep 18, 2024
1 parent e197f2b commit 37c9ec6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/reference/widgets/Tabulator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,27 @@
"styled"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can style your tables with gradients using the [`.text_gradient`](https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.text_gradient.html) or [`.background_gradient`](https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.background_gradient.html#pandas.io.formats.style.Styler.background_gradient) methods, along with [named Matplotlib color maps](https://matplotlib.org/stable/gallery/color/colormap_reference.html).\n",
"\n",
"**Note:** Styling with gradients requires Matplotlib to be installed."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"gradient_table = pn.widgets.Tabulator(style_df)\n",
"gradient_table.style.text_gradient(cmap=\"RdYlGn\", subset=[\"B\", \"C\"])\n",
"gradient_table.style.background_gradient(cmap=\"RdYlGn\", subset=[\"D\", \"E\"])\n",
"gradient_table"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit 37c9ec6

Please sign in to comment.