I'm trying to format the y axis in a ggplot graph with a space (and not a comma) as thousand separator ;
something like 10 000 and not 10,000.
I can't found it in the scale_y_continuous
help.
Thanks for any hint.
I'm trying to format the y axis in a ggplot graph with a space (and not a comma) as thousand separator ;
something like 10 000 and not 10,000.
I can't found it in the scale_y_continuous
help.
Thanks for any hint.
As @David and @joran just said.
First, define the label formatter:
space <- function(x, ...) {
format(x, ..., big.mark = " ", scientific = FALSE, trim = TRUE)
}
and then use it with scale_y_continous
:
plot + scale_y_continuous(labels = space)
I'm just taking a stab in the dark, but scale_y_continuous(labels = space)
might do the trick.