R flexdashboard remove title bar

五迷三道 提交于 2019-11-30 20:56:14

You can just add CSS styling directly to your markdown document (no JQuery required):

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---
<style>

body {
  padding-top:0px
}

.navbar{
  visibility: hidden
}

</style>


```{r setup, include=FALSE}
library(flexdashboard)
```

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r}
hist(iris$Sepal.Length)

```

Column {data-width=350}
-----------------------------------------------------------------------

### Chart B

```{r}
hist(iris$Sepal.Width)
```

### Chart C

```{r}
hist(iris$Petal.Length)
```

Results in:

I am not aware of any flexdashboard option. But you could use jQuery to remove the navbar and move the body up. Just include the following snippet right after your YAML:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
  $('.navbar').remove();
  $('body').css('padding-top', '0px');
});
</script>

I think this leaves the main navigation bar of the parent document untouched. If not it might need some lsight modification.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!