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

Feature request: include rgl output automatically. #404

Closed
dmurdoch opened this issue Jan 23, 2022 · 2 comments
Closed

Feature request: include rgl output automatically. #404

dmurdoch opened this issue Jan 23, 2022 · 2 comments
Labels
feature a feature request or enhancement wip work in progress

Comments

@dmurdoch
Copy link

It would be nice if rgl output was automatically included in reprex() output. This should be easy to do because knitr has supported rgl output for a while now. All that is needed is to run rgl::setupKnitr(autoprint = TRUE) and snapshots of output will be produced.

To set this automatically, reprex() could run the following code:

setHook(packageEvent("rgl", "onLoad"),
        function(...) rgl::setupKnitr(autoprint = TRUE))

I would be happy to submit a PR to do this if you give me a hint where it should happen. Here's what output would look like with this addition (though of course thesetHook() call won't be displayed if reprex() runs it internally):

setHook(packageEvent("rgl", "onLoad"),
        function(...) rgl::setupKnitr(autoprint = TRUE))
library(rgl)
plot3d(1:10, 1:10, 1:10)

Created on 2022-01-23 by the reprex package (v2.0.1)

For anyone reading this and running reprex without this facility, you don't really need to do it as a hook, it's enough to run the line in the code you're reproducing, e.g.

rgl::setupKnitr(autoprint = TRUE))
library(rgl)
plot3d(1:10, 1:10, 1:10)
@jennybc jennybc added feature a feature request or enhancement wip work in progress labels Mar 4, 2022
@jennybc
Copy link
Member

jennybc commented Mar 7, 2022

The current plan is to probably handle this inside rgl itself. See the PR for discussion.

@dmurdoch
Copy link
Author

dmurdoch commented Mar 7, 2022

Done now, included in rgl 0.108.21 (which is only available on Github at the moment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement wip work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants