davidhodge931 / ggblanket

Simplify ggplot2 visualisation
https://davidhodge931.github.io/ggblanket/
Other
150 stars 8 forks source link

`text`/`label`: remove these aesthetics and functions #868

Closed davidhodge931 closed 3 months ago

davidhodge931 commented 3 months ago

Potentially remove gg_text and gg_label too

davidhodge931 commented 3 months ago

Logic is because you often need to round or add commas to numbers, and it's easier to do this using mapping = aes(label = round(label, 0)) etc - rather than mutate(label = round(label, 0)) and label = label

davidhodge931 commented 3 months ago
bind_rows(
  mtcars |> slice_min(order_by = mpg),
  mtcars |> slice_max(order_by = mpg)) |>
  tibble::rownames_to_column("model") |>
  gg_text(
    x = model,
    y = mpg,
    col = mpg,
    label = model,
    y_expand_limits = 0,
    y_label = "Miles per gallon",
    col_palette = c(orange, "white", teal),
  )
davidhodge931 commented 3 months ago

Leave as is