---
jupyter: python3
aliases:
  - ../index.html
html-table-processing: none
---

<div style="text-align: center;">

# gt-extras

</div>

### What is [gt-extras](https://posit-dev.github.io/gt-extras)?

We provide a collection of helper functions to enhance tables created with the Python package [great-tables](https://posit-dev.github.io/great-tables/).


The functions in **gt-extras** are designed to make it easier to add plots, icons, color gradients, and other enhancements to your tables. We wrap up common patterns and boilerplate so you can focus on your data and presentation. It is based on the R package [gtExtras](https://jthomasmock.github.io/gtExtras/index.html), which was designed with a similar goal in mind.

### How can I use it?
Install the latest release from **PyPI**:

```bash
$ pip install gt_extras
```

Now we can modify a _great table_ with a collection of gt-extras features. From plotting, to icons, to color palettes, we've got quite the range of ready-to-use add-ons!

```{python}
from great_tables import GT
from great_tables.data import gtcars
import gt_extras as gte

gtcars_mini = gtcars.iloc[5:15].copy().reset_index(drop=True)
gtcars_mini["efficiency"] = gtcars_mini["mpg_c"] / gtcars_mini["hp"] * 100

(
    # Start with a standard GT
    GT(gtcars_mini, rowname_col="model")
    .tab_stubhead(label="Car")
    .cols_hide(["drivetrain", "hp_rpm", "trq_rpm", "trim", "bdy_style", "msrp", "trsmn", "ctry_origin"])
    .cols_align("center")
    .tab_header(title="Car Performance Review", subtitle="Using gt-extras functionality")

    # Add gt-extras features using gt.pipe()
    .pipe(gte.gt_color_box, columns=["hp", "trq"], palette=["lightblue", "darkblue"])
    .pipe(gte.gt_plt_dot, category_col="mfr", data_col="efficiency", domain=[0, 0])
    .pipe(gte.gt_plt_bar, columns=["mpg_c", "mpg_h"])
    .pipe(gte.gt_fa_rating, columns="efficiency")
    .pipe(gte.gt_hulk_col_numeric, columns="year", palette="viridis")
    .pipe(gte.gt_theme_538)
)
```

<br>
And for a little comparison, here is the table before the gt-extras features were applied.

```{python}
#| code-fold: true
#| code-summary: Show the Code
(
  GT(gtcars_mini, rowname_col="model")
    .tab_stubhead(label="Car")
    .cols_hide(["drivetrain", "hp_rpm", "trq_rpm", "trim", "bdy_style", "msrp", "trsmn", "ctry_origin"])
    .tab_header(title="Car Performance Review", subtitle="Using gt-extras functionality")
)
```

For a more comprehensive guide, head over to the [Get Started](../get-started/) page, and for the most comprehensive guide, see the [reference docs](../reference/)!

## Features

- Apply color gradients and highlights
- Add plots to table cells for visual data representation
- Embed FontAwesome icons
- Use pre-built themes for quick styling
- Utilize helper utilities for common table tasks

::: {.callout-warning collapse="false"}
gt-extras is currently in development, expect breaking changes.
:::

## Contributing
If you encounter a bug, have usage questions, or want to share ideas to make this package better, please feel free to file an [issue](https://github.com/posit-dev/gt-extras/issues).

In general, if you're interested in extending **Great Tables** functionality, [this subsection of the Great Tables get-started page](https://posit-dev.github.io/great-tables/get-started/extensions) is a great place to start.

::: {.callout-tip collapse="false"}
## What you might get to consider

Some of the work that went into this project was featured on the [_great tables blog_](https://posit-dev.github.io/great-tables/blog/plots-in-tables/), if you choose to contribute hopefully that can give you a sense of the process!

:::

## Code of Conduct
Please note that the **gt-extras** project is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).<br>By participating in this project you agree to abide by its terms.


## License

**Great Tables** is licensed under the MIT license.

© Posit Software, PBC.
