scale_comma: Axis formatting with commas

scale_commaR Documentation

Axis formatting with commas

Description

Wrappers around 'ggplot2::scale_x_continuous' and 'ggplot2::scale_y_continuous' to make it easy to format with commas

Usage

scale_x_comma(
  ...,
  labels = scales::comma_format(accuracy = 1, scale = 1, prefix = "", suffix = "",
    big.mark = ",", decimal.mark = ".", trim = TRUE)
)

scale_y_comma(
  ...,
  labels = scales::comma_format(accuracy = 1, scale = 1, prefix = "", suffix = "",
    big.mark = ",", decimal.mark = ".", trim = TRUE)
)

Arguments

...

Arguments to 'ggplot2::scale_x_continuous' and 'ggplot2::scale_x_continuous'

labels

default is 'scales::percent' See '?ggplot2::scale_x_continuous' for additional details

References

https://github.com/thomas-neitmann/scalesextra

Examples

library(dplyr)
library(ggplot2)
library(palmerpenguins)

penguins %>%
  ggplot(data = .,
         aes(x = flipper_length_mm,
             y = body_mass_g,
             colour = species,
             shape = species)) +
  geom_point()

penguins %>%
  ggplot(data = .,
         aes(x = flipper_length_mm,
             y = body_mass_g,
             colour = species,
             shape = species)) +
  geom_point() +
  scale_y_comma()


emilelatour/laviz documentation built on Nov. 11, 2024, 9:42 p.m.