我想在RStudio中使用来自bootstrap包的navtabs。我想在导航标签中显示图表。但是我得到的结果是:
在我看来,作为非HTML专家,无法找到png文件,因为它们没有呈现或路径错误。
如何确保在最终的html页面中显示这些图?
---
output: html_document
---
<!--html_preserve-->
<div class="container">
<ul class="nav nav-tabs">
<li class="nav active"><a href="#A" data-toggle="tab">A</a></li>
<li class="nav"><a href="#B" data-toggle="tab">B</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane fade in active" id="A">
```{r a, echo = F}
plot(1,2)
```
</div>
<div class="tab-pane fade" id="B">
```{r b, echo = F}
plot(2,1)
```
</div>
</div>
</div>
<!--/html_preserve-->
答案 0 :(得分:0)
使用<!--html_preserve-->
---
output: html_document
---
<!--html_preserve-->
<div class="container">
<ul class="nav nav-tabs">
<li class="nav active"><a href="#A" data-toggle="tab">A</a></li>
<li class="nav"><a href="#B" data-toggle="tab">B</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane fade in active" id="A">
<!--/html_preserve-->
```{r a, echo = F}
plot(1,2)
```
<!--html_preserve-->
</div>
<div class="tab-pane fade" id="B">
<!--/html_preserve-->
```{r b, echo = F}
plot(2,1)
```
<!--html_preserve-->
</div>
</div>
</div>
<!--/html_preserve-->