Reputation: 1426
In my following code:
library(ggplot2)
library(scales)
myData <- data.frame(
platform = c("Windows", "MacOs", "Linux"),
number = c(27000, 16000, 9000)
)
ggplot(myData, aes(x = reorder(platform, -number), y = number))+
geom_bar(stat="identity", fill="darkturquoise", width = 0.5)+
geom_text(aes(label = number), vjust=-0.3)+
xlab("Platform")+
scale_y_continuous(breaks = round(seq(0,40000, by = 5000), 1))
How do I change the param of scale_y_continuous
to reduce the number of 000
? i.e, the y-tick will show 5, 10, 15, 20, 25...
Upvotes: 0
Views: 252
Reputation: 27732
Divide the y-axis' labels by 1000 like so:
ggplot(myData, aes(x = reorder(platform, -number), y = number))+
geom_bar(stat="identity", fill="darkturquoise", width = 0.5)+
geom_text(aes(label = number), vjust=-0.3)+
xlab("Platform")+
scale_y_continuous(breaks = seq( 0,40000, by = 5000),
labels = function(y_value) y_value / 1000) # <- ! here !
Upvotes: 2