How to store r ggplot graph as html code snippet

前端 未结 3 1384
你的背包
你的背包 2021-02-10 01:52

I am creating an html document by creating various objects with ggplotly() and htmltools functions like h3() and html(). Then I submit th

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-10 02:40

    I think what you want may be close to one of the following:

    1. Seems you are creating an HTML report but hasn't checked out RMarkdown. It comes with Base64 encode. When you create an RMarkdown report, pandoc automatically converts any plots into an HTML element within the document, so the report is self-contained.

    2. SVG plots. This is less likely to be what you might want, but SVG plots are markup-language based and may be easily portable. Specify .svg extension when you use ggsave() and you should be getting an SVG image. Note that SVG is an as-is implementation of the plot, so if can be huge in file size if you have thousands of shapes and lines.

提交回复
热议问题