animation icon indicating copy to clipboard operation
animation copied to clipboard

How to embed in Markdown&html outside Rmd and shiny

Open huyingjie opened this issue 6 years ago • 3 comments

My blog uses hexo, which is a static website generator. Each blog post is a Markdown file. blogdown developed by Yihui Xie has a lot of errors and I do not have the knowledge to fix them. I do not use shiny.

How to embed the animation plot generated in a Markdown file? Do you have javascript link similar to bootstrap<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>?

How to get the javascript code containing data which generates the animation plot?

Thank you.

huyingjie avatar Dec 16 '17 20:12 huyingjie

I am not familiar with hexo. But you can generate the animation figure on your local computer, and upload it to online storage platform. Then you can embed the figure with markdown syntax ![GitHub Logo](/images/logo.png).

Animation is not a javascript library, if you want to generate animation picture with javascript, please take a look at D3.js and ployly, there are a lot of ways to produce dynamic, interactive data visualizations in web browsers.

yulijia avatar Dec 18 '17 16:12 yulijia

@yulijia Thank you for your reply. My definition of animation is not clear. It is not an animated gif file. I want to embed graphs generated from ployly r package. Yes, there are a lot of r packages generating interactive visualization graph. But none of them supply the raw codes of javascript. Thus, it is impossible for me to embed them in hexo.

Hexo will automatically convert a html which has interactive grah into a post. But I want to embed them in a post, not to create a graph as a whole post.

huyingjie avatar Dec 18 '17 23:12 huyingjie

This is maybe what you need: Data Visualization Using Plotly in Hexo, and here is the raw html code of that post.

Hexo cannot convert any r code (in Markdown file) to figure (in html static website). Please use blogdown, also Yihui provides a simple example at blogdown-hexo.

If you have any question when using blogdown, please ask them on StackOverflow with the blogdown tag.

yulijia avatar Dec 19 '17 00:12 yulijia