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

Package name to accept expression() #105

Closed
rafapereirabr opened this issue Aug 19, 2020 · 3 comments
Closed

Package name to accept expression() #105

rafapereirabr opened this issue Aug 19, 2020 · 3 comments

Comments

@rafapereirabr
Copy link
Contributor

It would be great if we could pass a mathematical expression() as a package name to the sticker function.

library(ggplot2)
library(hexSticker)

p <- ggplot(aes(x = mpg, y = wt), data = mtcars) + geom_point() +
  annotate("text", x = 25, y = 5, size=8, label = expression(paste("x"^2,"y")) ) +
  theme_void() + theme_transparent()


sticker(p, package= expression(paste("x"^2,"y")), p_size=20, s_x=1, s_y=.75, s_width=1.3, s_height=1,
        filename="man/figures/ggplot2.png")


@rafapereirabr
Copy link
Contributor Author

rafapereirabr commented Aug 19, 2020

Perhaps changing the geom_pkgname function like this could work.

geom_pkgname <- function (package, x = 1, y = 1.4, color = "#FFFFFF", family = "Roboto", 
                          size = 8, ...) 
{
  # family <- load_font(family)
  annotate("text", x = x, y = y, label = package,  size = size, color = color, family = family )
}

GuangchuangYu added a commit that referenced this issue Aug 20, 2020
@GuangchuangYu
Copy link
Owner

supported.

@rafapereirabr
Copy link
Contributor Author

Thanks!

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

No branches or pull requests

2 participants