Change the thousands separator in a ggplot Change the thousands separator in a ggplot r r

Change the thousands separator in a ggplot


p + scale_y_continuous(labels=function(x) format(x, big.mark = ".", scientific = FALSE))


this also works:

p + scale_y_continuous(labels = scales::comma)


Very good answer. As you are defining a thousands separator, it is better to also define the decimal separator as a comma, to avoid errors.

p + scale_y_continuous(labels=function(x) format(x, big.mark = ".", decimal.mark = ",", scientific = FALSE))