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

Plotly graphs are not displayed in knitr output if produced inside a loop #1341

Closed
Stan125 opened this issue Sep 20, 2018 · 1 comment
Closed

Comments

@Stan125
Copy link

Stan125 commented Sep 20, 2018

If plotly graphs are printed inside a loop and not with subgroup, which is necessary if you have a lot of plots, then it just doesn't work.

Input

Consider this minimal working example:
screen shot 2018-09-20 at 16 37 42

The code for this is here. Sorry, there is no way to to syntax highlighting for .Rmd files so I cannot display it in this issue with the correct code.

Output

Only the second code chunk can yield outputs. The first plots just don't show up in the resulting .pdf file. Here is the resulting .pdf file:
Untitled.pdf

Essentially, if I make a list of plotly objects and print them, knitr does not catch them, even with htmltools and all that. If I ust print them without looping, everything works.

@cpsievert
Copy link
Collaborator

Try wrapping the list in htmltools::tagList() #273 (comment)

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