In the following ggplot barchart. How can I generate a vector with multiple expressions automatically?
data <- data.frame(x = LETTERS[1:11], y = 10^(0:10))
z <- 0:10
y.labels <- sprintf(paste0("10^", z))
ggplot(data, aes(x, y)) +
geom_bar(stat = "identity") +
scale_y_log10(breaks = 10^(z), labels = y.labels)
I've tried with bquote(.(10^c(z))), but is not the desired result .
My only alternative is to do it manually, but it is not automatic:
y.labels <- expression("10"^0, "10"^1, "10"^2, "10"^3, "10"^4, "10"^5, "10"^6, "10"^7, "10"^8, "10"^9, "10"^10)
