I wish to label the x-axis of a volcano plot I made using EnhancedVolcano as "Log2(B/A)" where 2 is a subscript, and B/A is a character vector I define as X.axis. Xlab is one of the arguments of EnhancedVolcano function.
I tried:
X.axis <- "(B/A)"
log2 <- expression(~Log[2])
xlab = paste(log2,X.axis)
Result was ~Log[2](B/A)
I also tried:
log2 <- expression(~Log[2]~X.axis)
xlab = log2
This gave Log2 X.axis
.
What am I doing wrong?
CodePudding user response:
X.axis <- "B/A"
ggplot(mtcars, aes(mpg, disp))
geom_point()
scale_x_continuous(name = bquote(Log[2] * bgroup("(", .(X.axis), ")" )))
Alternatively, you can do a more-apparent fraction, though it is easier (given what little I know of your available variables) to do it statically:
ggplot(mtcars, aes(mpg, disp))
geom_point()
scale_x_continuous(name = bquote(Log[2] * bgroup("(", over(B, A), ")" )))