Closed evian999 closed 1 year ago
Instead of manually adding scale_x/y_*()
to the qcorrplot()
function, we can set parse = TRUE
in qcorrplot()
to handle the subscript/superscripts of axis labels, as shown in the following example:
library(linkET)
d <- mtcars
names(d) <- c("NH^4", names(d)[-1L])
correlate(d) |>
qcorrplot(parse = TRUE) +
geom_square()
Note that linkET
uses a style similar to LaTex to distinguish between superscripts and subscripts, for example:
x <- "label^{this is superscript}_{this is subscript}"
Thank you so much! your answer perfectly solve my problem and I believe your answer will also benefit many people who encounter the same error like me, due to I have read various articles about "how to present special sympols like superscription" with this package. However, none of those solutions actually work. Overall, I really appreciate your reply! And I will close this issue later.
Instead of manually adding
scale_x/y_*()
to theqcorrplot()
function, we can setparse = TRUE
inqcorrplot()
to handle the subscript/superscripts of axis labels, as shown in the following example:library(linkET) d <- mtcars names(d) <- c("NH^4", names(d)[-1L]) correlate(d) |> qcorrplot(parse = TRUE) + geom_square()
Note that
linkET
uses a style similar to LaTex to distinguish between superscripts and subscripts, for example:x <- "label^{this is superscript}_{this is subscript}"
as the title, and i had tried several ways to achieve this.
scale_x_discrete
: not in avail. And there are glaring wrong with the square.ggtext::markdown
: not in avail.linkET::element_formula
: withparse=T
, there is nothing change with the orgin label, that is, remain displayingCO[2]
on the figure.linkET::latex_formula
: not in avail. this function changeCO[2]
toCO *'['*, 2, *']'*
and then just straightfoward display in the figure.here's the figure with problem, and code attach it. Figure is the result when try the function
ggtext::element_markdown
andscale_x_discrete
as description above.