我想htmlwidgets
在同一个 Rmarkdown 文档中包含两个 - 包中的mermaid
流程图DiagrammeR
和network3D
图表。如果我将两者都包含在我的文档中,那么它们都不会呈现,但如果我只包含其中一个,那么它将被呈现。
这是 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)
```
如果我DiagrammeR
基于添加多个图表,grViz
那么一切都很好。另外,如果我省略了mermaid
情节,那么我会看到剩下的两个。他们不应该很好地一起玩吗?我试图交换library
呼叫的顺序无济于事。