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

textbox_grob's name argument appears to not work #13

Open
matthewstern opened this issue Sep 26, 2020 · 1 comment
Open

textbox_grob's name argument appears to not work #13

matthewstern opened this issue Sep 26, 2020 · 1 comment

Comments

@matthewstern
Copy link
Contributor

textbox_grob has been incredibly useful for me, but I noticed that although name is listed as an argument in the documentation, assigning a name doesn't appear to have any impact on the gTree object that the function creates:

Input:

library(grid)
library(gridtext)

sample_textbox <- textbox_grob("I am a grob", 0.5, 0.5, 0.5, 0.5,
                               name = "grobname",
                               box_gp = gpar(fill = "gray90"))
grid.newpage()
grid.draw(sample_textbox)

sample_textbox$name

Output:
[1] "GRID.textbox_grob.198"

On inspection of the source code, it appears that name = name is missing from the gTree creation at the end of the textbox_grob function, where it is included in richtext_grob. Is there a reason for this? It would be helpful for me to be able to name the gTree that is created by the function.

@clauswilke
Copy link
Collaborator

No good reason, other than me being stubborn because I fundamentally dislike grid's grob naming system. (It's one of the reasons grid performance is poor.)

Feel free to prepare a PR that fixes this.

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