I am using scale_fill_gradient2()
and the colourbar that is created is showing decimal places. I tried to reproduce the text that shows decimals but could not but the text below is in scientific notations.
How can you round the numbers that displayed in the colourbar using scale_fill_gradient2()
? For example I am seeing "25.00" and I'd like to show just "25"?
Also how can you set the labels manually? Let's say I want to look a the data and set labels like c(15, 25, 40)
?
library(ggplot2)
dat <- data.frame(group = c(rep("A", 10), rep("B", 10)),
value = c(rnorm(10, 5,300), rnorm(10, 5000, 80000)))
ggplot(dat, aes(x = group, y = value, fill= value)) +
geom_bar(stat = "identity") +
scale_fill_gradient2(low = "red", mid = "yellow", high = "blue", midpoint = 0, name = "")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.