stats_noob
stats_noob

Reputation: 5897

Adjusting Border Widths in R

I found this stackoverflow post here (Input menu contents do not overflow row box in flexdashboard) and I slightly adapted the code:

---
title: "Test Dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
runtime: shiny
---

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

Column {data-width=600}
-----------------------------------------------------------------------

### Window 1

```{r}
selectInput("project", label = NULL, choices = c("A","B","C","D"))
```


Column {data-width=400}
-----------------------------------------------------------------------

### Chart B

```{r}
renderPlot({
  plot(rnorm(1000), type = "l", main = paste("Project:",input$project, " Data:", input$data))
})
```

enter image description here

Is it possible to adjust this code so that output looks something like this?

enter image description here

I tried adjusting different values of Column {data-width=600} and Column {data-width=400} ... but nothing seems to be working.

Does anyone know how to fix this?

Thank you!

Upvotes: 1

Views: 146

Answers (1)

Kat
Kat

Reputation: 18714

You can put them in the same chunk or leave them separate, the only part that matters if you want them in the same row is that they're in the same row. For example:

Column {data-width=600}
-----------------------------------------------------------------------

### Window 1 {data-height=500}

```{r puts}
selectInput("project", label = NULL, choices = c("A","B","C","D"))

```

```{r plottty}

plot_ly(mtcars, x = ~mpg, y = ~am, type = "bar", height = 400)

```

Did you notice that I added a row height and a height to the plot? That's because Plotly will ignore fig.height and out.height. It will render at the height of its parent here, but with the search bar, that drops part of the plot below what you can see. When you define the row height and the plot height, you avoid this problem.

enter image description here



Since you asked (not here) about this, I thought I would add about "The Jones' House" (Yeah, I know it's spelled different in the code, but I can't but feel like grammatically it's all wrong...but how can I say that about someones else's name, ya know?) Anyway...

Bedroom {data-navmenu='The Joneses House'}
=====================================

More info...

Kitchen {data-navmenu='The Joneses House'}
=====================================

### Window 1 {data-height=500}

```{r boxy}

shiny::selectInput('big things', label = NULL, choices = LETTERS[1:4])

```


```{r plotty}

plot_ly(mtcars, x = ~mpg, y = ~am, type = "bar", height = 400)

```

enter image description here

Upvotes: 1

Related Questions