Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsing bug with plotmath #60

Closed
fawda123 opened this issue Nov 28, 2016 · 7 comments
Closed

parsing bug with plotmath #60

fawda123 opened this issue Nov 28, 2016 · 7 comments
Labels
bug

Comments

@fawda123
Copy link

@fawda123 fawda123 commented Nov 28, 2016

Hi there, I can't seem to get this working:

library(ggplot2)
library(ggrepel)

ggplot(data.frame(x = 1, y = 1, Parameter = "italic(z)"), aes(x, y)) + 
  geom_point() + 
  geom_label_repel(aes(label = Parameter), parse = T)

Returns the error 'Error in x$lab != "" : comparison is not allowed for expressions'

> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggrepel_0.6.5 ggplot2_2.2.0

loaded via a namespace (and not attached):
 [1] labeling_0.3     colorspace_1.2-7 scales_0.4.1     assertthat_0.1   lazyeval_0.2.0  
 [6] plyr_1.8.4       tools_3.3.2      gtable_0.2.0     tibble_1.2       Rcpp_0.12.7     
[11] grid_3.3.2       munsell_0.4.3   
@slowkow slowkow added the bug label Nov 29, 2016
slowkow added a commit that referenced this issue Nov 29, 2016
@slowkow
Copy link
Owner

@slowkow slowkow commented Nov 29, 2016

Thanks for reporting this issue!

Could I ask you to install the version 0.6.6 from github and let me know if things work as expected for you?

install.packages("devtools")
devtools::install_github("slowkow/ggrepel@0.6.6")

Also, I added an example with math expressions to the vignette:

library(gridExtra)

set.seed(0)
d <- data.frame(
  x = runif(30),
  y = runif(30),
  Parameter = c(
    "prod(plain(P)(X == x), x)",
    "integral(f(x) * dx, a, b)",
    "lim(f(x), x %->% 0)",
    rep("", 27)
  )
)

p1 <- ggplot(d, aes(x, y, label = Parameter)) +
  geom_point() +
  geom_text_repel(
    parse = TRUE, size = 8,
    min.segment.length = unit(0, "lines"),
    point.padding = unit(0.5, "lines"),
    box.padding = unit(0.5, "lines")
  ) +
  theme_classic(base_size = 20)

p2 <- ggplot(d, aes(x, y, label = Parameter)) +
  geom_point() +
  geom_label_repel(parse = TRUE, size = 8, alpha = 0.5) +
  theme_classic(base_size = 20)

grid.arrange(p1, p2, ncol = 2)

image

@slowkow slowkow closed this Nov 29, 2016
@fawda123
Copy link
Author

@fawda123 fawda123 commented Nov 29, 2016

Thanks, appears to be working now.

@smouksassi
Copy link

@smouksassi smouksassi commented Jun 27, 2017

That solved also a problem I had with the cran version where I use a label to show a correlation in a ggplot plot. Will this get official and released soon ? great package

@ggautreau
Copy link

@ggautreau ggautreau commented Nov 10, 2017

Yes i agree with @smouksassi , will this get official and released soon ?

@slowkow
Copy link
Owner

@slowkow slowkow commented Nov 10, 2017

Yes, math expressions were already available last year via Github on ggrepel version 0.6.6. See the news about changes for more details. The current version on CRAN is 0.7.0, and has some additional features and fixes detailed in the news file.

Please see here for an example of how to plot math expressions with ggrepel.

Would it be helpful if I create an announcement or blog post for new features and CRAN releases?

@ggautreau
Copy link

@ggautreau ggautreau commented Nov 10, 2017

Thank you :)

@smouksassi
Copy link

@smouksassi smouksassi commented Nov 10, 2017

this issue should be closed as the cran version works ! thank you for the great work and package !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.