在markdown和bootstrap导航选项卡中不可见的图

时间:2015-02-15 13:49:47

标签: r twitter-bootstrap-3 rstudio r-markdown

我想在RStudio中使用来自bootstrap包的navtabs。我想在导航标签中显示图表。但是我得到的结果是:

results enter image description here

在我看来,作为非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-->

1 个答案:

答案 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-->