我希望在同一個Rmarkdown文檔中包含兩個htmlwidgets
-流程圖來自DiagrammeR
包和network3D
圖。如果我將它們都包含在我的文檔中,那麼它們都不會渲染,但如果我只包含其中的一個,那麼它將被渲染。在Rmarkdown中混合netword3D和mermaid會渲染渲染
下面是Rmarkdown一個小例子,顯示問題
---
title: "Untitled"
author: "Me"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## The grViz always works
```{r dia1, echo=FALSE}
library(DiagrammeR)
grViz("
digraph {
layout = twopi
A -> {B C D}
}")
```
# From here onwards I can only include one of the two graphs
```{r}
mermaid("
graph LR
A-->B
")
```
# Plot
```{r}
library(networkD3)
Source <- c("A", "A", "A", "A", "B", "B", "C", "C", "D")
Target <- c("B", "C", "D", "J", "E", "F", "G", "H", "I")
NetworkData <- data.frame(Source, Target)
# Create graph
simpleNetwork(NetworkData)
```
如果我添加基於grViz
那麼一切都很好,很正常多個DiagrammeR
圖。另外,如果我離開了mermaid
情節話,我會看到剩下的兩個。他們不應該一起玩嗎?我試圖將library
調用的順序替換爲無效。
是啊。就是這樣。我已經提交了[問題與製圖(https://github.com/rich-iannone/DiagrammeR/issues/232)開發商,我們將看到如何平移出。謝謝! – ekstroem