使用
我采用了链接SO帖子中的代码,并仅更改了标题中的输出格式。 有人知道如何在此类输出中正确呈现plotly图形吗? 或者至少,如果可能的话?
ggplotly()
创建的交互式图表可以很好地与R Markdown中的html_document
输出配合使用,例如请参见RMarkdown和ggplotly。但是对于github_document
输出,生成的HTML预览文件不会显示ggplotly()
图形。我采用了链接SO帖子中的代码,并仅更改了标题中的输出格式。 有人知道如何在此类输出中正确呈现plotly图形吗? 或者至少,如果可能的话?
---
title: "RmarkdownExample"
author: "fdetsch"
date: "April 16, 2020"
output: github_document
---
Here is the graph I generated.
```{r setup, message = FALSE, echo = FALSE, warning=FALSE}
# Require
library(plotly)
# Create
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
# Plot
g <- qplot(carat, price, data=dsamp, colour=clarity)
# Call
ggplotly(g)
```
output: github_document
的解决方法,并且也分享了代码。老实说,我认为两个答案都有其合理的地方,这使得很难在它们之间做出选择。 - fdetsch