This answer is out of date for ggplot2 version 0.90. Now, the same format would be specified (much more neatly) this way:
scale_y_continuous(labels=function(x)x*1000)
or if you want to use the same labelling scheme multiple times:
formatter1000 <- function(){
function(x)x*1000
}
scale_y_continuous(labels=formatter1000())
Note that if you are specifying axis limits using the xlim
and ylim
functions, this might not work. Instead, use the scale_y_continuous(..., limits=c(0, 1))
specification.
There are also a bunch of built in formats in the scales
package, including comma formatting, percentage formatting, dollar formatting and scientific notation formatting. See its documentation for more details.
Hope that helps someone out there, as this change certainly confused me!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…