Reputation: 5366
I would like to format the numbers on a continuous axis in a ggplot graph. I would like to have a French formatting for large numbers with a space every three digit (ie "20 000" instead of "20000"). I know it is possible to do it using the format()
function (for instance 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 the scale_y_continuous()
but I was unable to find the solution by myself.
Here is my gist file.
Upvotes: 6
Views: 1832
Reputation: 77096
french = function(x) format(x, big.mark = " ")
p + scale_y_continuous(labels=french)
Upvotes: 12