add_label_position | R Documentation |
Calculates the y-coordinates for stacked bar charts, centered for each group. The default function does not work if some labels are filtered.
add_label_position( df, x_var, y_var, facet_var = NULL, fill_var, filter_cutoff = 0.05, fill_reverse = FALSE, is_percentage = FALSE )
df |
Data frame |
x_var |
Required variable name for the variable containing the discrete x-coordinates. |
y_var |
Required variable name for the variable containing the
y-coordinates. Will be coerced to numeric with |
facet_var |
Optional variable name for the discrete variable to facet by, defaults to NULL. |
fill_var |
Variable name for the discrete variable which determines the groups to be stacked, e.g. degree. |
filter_cutoff |
Optional cutoff value for the suppression of data labels. By default, all values below 0.04 of the total value of the stacked bar chart are suppressed. |
fill_reverse |
Boolean indicating whether the order of the fill variable should be reversed, defaults to FALSE. |
is_percentage |
Optional boolean indicating whether the value label is expressed in absolute numbers or as a percentage, defaults to false |
Data frame with additional column "label_" + the name of the y-coordinate variable
## Not run: add_label_position(df, x_var, y_var, fill) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.