Formatting numbers on a continuous axis in ggplot

I would like to format the numbers on the continuous axis in the ggplot graph. I would like to have French formatting for large numbers with a space every three digits (i.e. "20,000" instead of "20,000"). I know that this can be done using the format() function (for example, format(20000, scientific=FALSE, big.mark = " ") ), but I don’t know how to combine this function with ggplot. I can imagine that there is an option in scale_y_continuous() , but I could not find the solution myself. Here is my gist file .

+6
source share
1 answer
 french = function(x) format(x, big.mark = " ") p + scale_y_continuous(labels=french) 
+12
source

Source: https://habr.com/ru/post/952518/


All Articles