【发布时间】:2019-11-13 22:50:40
【问题描述】:
我想在嵌入到Rmarkdown 项目中的.dot 程序中使用图像作为节点。
我不知道如何使用DiagrammeR 让图像文件出现在输出中。
节点和类似 HTML 的标签似乎可以工作,只是 IMG 属性不行。
以下是我目前的代码:
digraph structs {
struct1 [shape=none, label=
<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" POINT-SIZE=\"8\">
<TR>
<TD ROWPAN=\"2\">
<FONT POINT-SIZE=\"16\">
Car
</FONT>
</TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD>
<FONT POINT-SIZE=\"10\">
Engine Size
</FONT>
</TD>
</TR>
<TR>
<TD>
<FONT POINT-SIZE=\"10\">
Paint Job
</FONT>
</TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD>
<FONT POINT-SIZE=\"10\">
AutoDrive ()
</FONT>
</TD>
</TR>
</TABLE>>
];
car1 [shape=none, label=\"\", image=\"../resources/images/car-clip-art.png\"];
<-- This doesn't work either. And this comment is *not* in the program -->
car1 [label=
<<TABLE>
<TR>
<TD>
<IMG SCALE=\"FALSE\" SRC=\"../resources/images/car-clip-art.png\"/>
</TD>
</TR>
</TABLE>>
];
struct1->car1
}
这是输出图像:
如何让图像显示在输出中?
【问题讨论】:
-
我通过安装 graphviz 来使用
dot.exe创建图形,然后使用knitr::include_graphics()将输出包含在我的 Rmarkdown 文件中。这很烦人,因为它引入了额外的依赖。我宁愿完全呆在 R 环境中
标签: graphviz diagrammer