在 Rmarkdown 中结合 netword3D 和美人鱼搞乱了渲染
Combining netword3D and mermaid in Rmarkdown messes up rendering
我想在同一个 Rmarkdown 文档中包含两个 htmlwidgets
- 来自 DiagrammeR
包的 mermaid
流程图和一个 network3D
图表。如果我将两者都包含在我的文档中,那么它们中的 none 会呈现,但如果我只包含其中一个,那么它将被呈现。
这是 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
调用的顺序但无济于事。
networkD3
已在 version 0.3 in. Feb. 2017, which is not compatible with v3 versions of D3, which is what DiagrammeR
appears to use. htmlwidgets
, which is the underlying package that drives networkD3
and DiagrammeR
, only uses the most recent version of a dependency, so htmlwidgets that use conflicting versions of the same library can not both work. Check here 中更新为 D3v4,作为讨论此问题的起点。
您有几个可能的选择,尽管其中 none 很棒...
将 networkD3
还原为 < 0.3 版本,以便它也使用 D3v3
DiagrammeR
developers 升级到 D3v4 的大厅
游说 htmlwidgets` developers 想出一个强大的方法来处理冲突的 JavaScript 依赖关系
我想在同一个 Rmarkdown 文档中包含两个 htmlwidgets
- 来自 DiagrammeR
包的 mermaid
流程图和一个 network3D
图表。如果我将两者都包含在我的文档中,那么它们中的 none 会呈现,但如果我只包含其中一个,那么它将被呈现。
这是 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
调用的顺序但无济于事。
networkD3
已在 version 0.3 in. Feb. 2017, which is not compatible with v3 versions of D3, which is what DiagrammeR
appears to use. htmlwidgets
, which is the underlying package that drives networkD3
and DiagrammeR
, only uses the most recent version of a dependency, so htmlwidgets that use conflicting versions of the same library can not both work. Check here 中更新为 D3v4,作为讨论此问题的起点。
您有几个可能的选择,尽管其中 none 很棒...
将
networkD3
还原为 < 0.3 版本,以便它也使用 D3v3DiagrammeR
developers 升级到 D3v4 的大厅游说 htmlwidgets` developers 想出一个强大的方法来处理冲突的 JavaScript 依赖关系