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

Provide a grid grob #1

Open
hadley opened this issue Jun 16, 2015 · 3 comments
Open

Provide a grid grob #1

hadley opened this issue Jun 16, 2015 · 3 comments

Comments

@hadley
Copy link

hadley commented Jun 16, 2015

This would be useful for people using grid graphics (e.g. ggplot2) so that you don't need to mess text rendering globally.

@yixuan
Copy link
Owner

yixuan commented Jun 16, 2015

Hi Hadley,
Could you explain a little bit more about this issue?
I believe showtext is only in the device level, in charge of rendering text.
Grob is more like a description of text, so it stays in the R level and will not be affected by showtext.

@hadley
Copy link
Author

hadley commented Jun 17, 2015

Currently showtext has global effect - it modifies all text rendering. But it would nice to be able to have local effect, so you could selectively use showTextGrob(). The behaviour would be identical, just the scope would be different.

@hadley hadley closed this as completed Jun 17, 2015
@hadley hadley reopened this Jun 17, 2015
@yixuan
Copy link
Owner

yixuan commented Jun 17, 2015

OK, now I understand the problem.
For base graphics, users can call showtext.begin() and showtext.end() to control the text rendering scope, but for grid graphics, since all graphics components are stored as an R object and then sent to graphics device in a batch, users cannot inject code in between plotting actions.
There may be some difficulties to fix this issue, since the current showtext works in the graphics device level, while grob lies in the graphics system level. Theoretically devices cannot see the outer world, for example it cannot tell whether one plotting action (such as drawing a circle) is from a base plot or a grid plot. It is only in charge of the rendering part.
I'm not so familiar with the grid system, so I have a few questions here: If I define a grob called showTextGrob(), can I customize how it will be plotted in the R level? If this is possible, one simple solution is to insert a showtext.begin() call inside the plotting method of this grob, and call showtext.end() when exitting.
If the answer is positive, I will then read some materials about grid system and grob customization.

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