I've modified the gt_plt_bar_pct function to add this functionality. It also supports arguments to adjust the font style (bold, normal, italic), round the label number, add percent signs, and specify the font color for the inside/outside labels.
By default, the function does not include labels -- this can be toggled by setting labels to TRUE.
The function places any labels for values <= 50% (of the max. value) to the right of the bar, while labels for all values > 50% are placed inside the bars. The user can specify any value for this cutoff (especially useful if you want to show more than 1 or 2 digits).
I mentioned this briefly in Discord, but there is no support for adding column value labels with
gt_plt_bar_pct
-- as there is withgt_plt_bar
.E.g. plotting with
gt_plt_bar_pct
I've modified the
gt_plt_bar_pct
function to add this functionality. It also supports arguments to adjust the font style (bold, normal, italic), round the label number, add percent signs, and specify the font color for the inside/outside labels.By default, the function does not include labels -- this can be toggled by setting
labels
to TRUE.The function places any labels for values <= 50% (of the max. value) to the right of the bar, while labels for all values > 50% are placed inside the bars. The user can specify any value for this cutoff (especially useful if you want to show more than 1 or 2 digits).
E.g., plotting with the same data:
I added documentation for the new arguments in the PR. I tried for consistency re: your docs, but you should definitely check and compare.