Skip to content

Commit d48addd

Browse files
authored
Merge branch 'main' into gt_plt_summary_customization
2 parents a04fe48 + b0d134e commit d48addd

File tree

13 files changed

+1115
-16
lines changed

13 files changed

+1115
-16
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,5 @@ sandbox.*
124124
possible_feats.*
125125
compare_themes.py
126126
compare_tables.html
127+
128+
README_FILES/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Python Versions](https://img.shields.io/pypi/pyversions/gt_extras.svg)](https://pypi.python.org/pypi/gt-extras)
44
[![PyPI](https://img.shields.io/pypi/v/gt-extras?logo=python&logoColor=white&color=orange)](https://pypi.org/project/gt-extras/)
5-
[![PyPI - Downloads](https://img.shields.io/pypi/dm/gt-extras)](https://pypistats.org/packages/gt-extras)
5+
[![PyPI Downloads](https://static.pepy.tech/badge/gt-extras)](https://pepy.tech/projects/gt-extras)
66
[![License](https://img.shields.io/github/license/posit-dev/gt-extras)](https://github.com/posit-dev/gt-extras/blob/main/LICENSE)
77

88
[![Tests](https://github.com/posit-dev/gt-extras/actions/workflows/ci_tests.yml/badge.svg)](https://github.com/posit-dev/gt-extras/actions/workflows/ci_tests.yml)

docs/_quarto.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ quartodoc:
5151
- gt_plt_bar_stack
5252
- gt_plt_bullet
5353
- gt_plt_conf_int
54+
- gt_plt_donut
5455
- gt_plt_dot
5556
- gt_plt_dumbbell
5657
- gt_plt_summary
@@ -92,6 +93,7 @@ quartodoc:
9293
- fa_icon_repeat
9394
- gt_fa_rank_change
9495
- gt_fa_rating
96+
- gt_fmt_img_circle
9597
- img_header
9698

9799
- title: Utilities

docs/examples/index.qmd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ addEventListener('resize', setTableWidths);
183183
[gt_plt_conf_int](./with-code.html#gt_plt_conf_int){.embed-hover-overlay}
184184
:::
185185

186+
:::{.masonry-item style="--width: 623;"}
187+
{{< embed with-code.qmd#gt_plt_donut >}}
188+
[gt_plt_donut](./with-code.html#gt_plt_donut){.embed-hover-overlay}
189+
:::
190+
186191
:::{.masonry-item style="--width: 304;"}
187192
{{< embed with-code.qmd#gt_plt_dot >}}
188193
[gt_plt_dot](./with-code.html#gt_plt_dot){.embed-hover-overlay}
@@ -288,6 +293,11 @@ addEventListener('resize', setTableWidths);
288293
[gt_fa_rating](./with-code.html#gt_fa_rating){.embed-hover-overlay}
289294
:::
290295

296+
:::{.masonry-item style="--width: 304;"}
297+
{{< embed with-code.qmd#gt_fmt_img_circle >}}
298+
[gt_fmt_img_circle](./with-code.html#gt_fmt_img_circle){.embed-hover-overlay}
299+
:::
300+
291301
:::{.masonry-item style="--width: 355;"}
292302
{{< embed with-code.qmd#img_header >}}
293303
[img_header](./with-code.html#img_header){.embed-hover-overlay}

docs/examples/with-code.qmd

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,35 @@ gt.pipe(
472472
```
473473
{{< include ./_show-last.qmd >}}
474474

475+
### [gt_plt_donut](https://posit-dev.github.io/gt-extras/reference/gt_plt_donut.html){title="Click for reference"}
476+
```{python}
477+
# | label: gt_plt_donut
478+
from great_tables import GT
479+
from great_tables.data import gtcars
480+
import gt_extras as gte
481+
482+
gtcars_mini = gtcars.loc[
483+
9:17,
484+
["model", "mfr", "year", "hp", "hp_rpm", "trq", "trq_rpm", "mpg_c", "mpg_h"]
485+
]
486+
487+
gt = (
488+
GT(gtcars_mini, rowname_col="model")
489+
.tab_stubhead(label="Car")
490+
.cols_align("center")
491+
.cols_align("left", columns="mfr")
492+
)
493+
494+
gt.pipe(
495+
gte.gt_plt_donut,
496+
columns=["hp", "hp_rpm", "trq", "trq_rpm", "mpg_c", "mpg_h"],
497+
size=40,
498+
fill="steelblue"
499+
)
500+
```
501+
{{< include ./_show-last.qmd >}}
502+
503+
475504
### [gt_plt_dot](https://posit-dev.github.io/gt-extras/reference/gt_plt_dot.html){title="Click for reference"}
476505
```{python}
477506
# | label: gt_plt_dot
@@ -949,6 +978,29 @@ gt.pipe(gte.gt_fa_rating, columns="rating", name="star")
949978
```
950979
{{< include ./_show-last.qmd >}}
951980

981+
### [gt_fmt_img_circle](https://posit-dev.github.io/gt-extras/reference/gt_fmt_img_circle.html){title="Click for reference"}
982+
```{python}
983+
# | label: gt_fmt_img_circle
984+
import polars as pl
985+
from great_tables import GT
986+
import gt_extras as gte
987+
988+
rich_avatar = "https://avatars.githubusercontent.com/u/5612024?v=4"
989+
michael_avatar = "https://avatars.githubusercontent.com/u/2574498?v=4"
990+
jules_avatar = "https://avatars.githubusercontent.com/u/54960783?v=4"
991+
992+
993+
df = pl.DataFrame({"@machow": [michael_avatar], "@rich-iannone": [rich_avatar], "@juleswg23": [jules_avatar]})
994+
995+
(
996+
GT(df)
997+
.cols_align("center")
998+
.opt_stylize(color="green", style=6)
999+
.pipe(gte.gt_fmt_img_circle, height=80)
1000+
)
1001+
```
1002+
{{< include ./_show-last.qmd >}}
1003+
9521004
### [img_header](https://posit-dev.github.io/gt-extras/reference/img_header.html){title="Click for reference"}
9531005
```{python}
9541006
# | label: img_header

gt_extras/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
from .formatting import fmt_pct_extra, gt_duplicate_column, gt_two_column_layout
1010
from .html import gt_merge_stack, with_hyperlink, with_tooltip
1111
from .icons import fa_icon_repeat, gt_fa_rank_change, gt_fa_rating
12-
from .images import add_text_img, img_header
12+
from .images import add_text_img, gt_fmt_img_circle, img_header
1313
from .plotting import (
1414
gt_plt_bar,
1515
gt_plt_bar_pct,
1616
gt_plt_bar_stack,
1717
gt_plt_bullet,
1818
gt_plt_conf_int,
19+
gt_plt_donut,
1920
gt_plt_dot,
2021
gt_plt_dumbbell,
2122
gt_plt_winloss,
@@ -56,6 +57,7 @@
5657
"gt_plt_dot",
5758
"gt_plt_conf_int",
5859
"gt_plt_dumbbell",
60+
"gt_plt_donut",
5961
"gt_plt_winloss",
6062
"gt_plt_bar_stack",
6163
"with_hyperlink",
@@ -66,6 +68,7 @@
6668
"gt_two_column_layout",
6769
"add_text_img",
6870
"img_header",
71+
"gt_fmt_img_circle",
6972
"gt_add_divider",
7073
"gt_plt_summary",
7174
]

0 commit comments

Comments
 (0)