stefano-meschiari / latex2exp

Use LaTeX in R graphics.
Other
185 stars 10 forks source link

Add phantom #22

Closed wzel closed 3 years ago

wzel commented 5 years ago

Add \phantom{} support.

wzel commented 4 years ago

Hi,

I just checked, and it works for me in annotations:

library(ggplot2)
library(latex2exp)

ggplot(data.frame(x = 1:2, y = 1:2),
       aes(x = x, y = y)) +
   geom_point() +
   annotate("text",
            x = 1.5, y = 1.5,
            label = TeX("a\\phantom{b}c"),
            parse = TRUE)
gtalckmin commented 4 years ago

This is what I have as output: phantom with this warning message:

Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'expression'

I installed the package from your repository using devtools::install_github("wzel/latex2exp")

these are the versions of the libraries installed. [1] latex2exp_0.4.0 ggplot2_3.3.2

Runing R version 4.02, Rstudio/Windows 10

Solution devtools::install_github(repo = "wzel/latex2exp", ref = "add-phantom")

PS: sorry was my mistake! Thanks for that , mate

wzel commented 4 years ago

Glad that you find this useful.