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

How can I export this figure in the ShinyApp #49

Closed
chenxi199506 opened this issue Dec 4, 2022 · 2 comments
Closed

How can I export this figure in the ShinyApp #49

chenxi199506 opened this issue Dec 4, 2022 · 2 comments

Comments

@chenxi199506
Copy link

chenxi199506 commented Dec 4, 2022

image

p <- r3dmol(id = "demo_sdf", elementId = "demo_sdf") %>%
m_add_model(data = benz, format = "sdf") %>%
m_set_style(style = m_style_stick()) %>%
m_set_style(sel = m_sel(model = 0),
style = m_style_stick(colorScheme = "cyanCarbon")) %>%
m_zoom_to()

output$pic <- renderPlot({(p)}, res = 96)

I am using this R package for a new shiny app construction in my paper

I find when i render this picture, it only shows in the Rstudio Plot window instead of the web

How can i fix that problem?

Thank you so much !

Ps
this was a great and very useful R package for me ! Thanks again for this amazing work !

@swsoyee
Copy link
Owner

swsoyee commented Dec 4, 2022

Actually, the output of r3dmol it's a web widget, so you can't export image natively.
Also see #48.

If you want to add output of r3dmol into Shiny,
you could use renderR3dmol https://github.com/swsoyee/r3dmol/blob/master/inst/example/app.R#L66
and r3dmolOutput https://github.com/swsoyee/r3dmol/blob/master/inst/example/app.R#L56.
And add m_png() at the end of r3dmol object.

@chenxi199506
Copy link
Author

Thank you so much for your reply!
It perfectly solved my problems!

I will cite your R package in my paper and recommend it for more researchers !

What a talented work !

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