Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reducing space between two box() in R shiny

the given script generates a simple histogram plot and a slider within two boxes. I wish to reduce the space between the two boxes and also between their extreme borders with the ends of the screen. Please help and thanks.snapshot of the plots

## app.R ##
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(
width = 0
),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(title = "Activity Frequency", status = "primary",height = "520", 
solidHeader = T,
plotOutput("plot1")),
box(title = "Activity Frequency", status = "primary",height = "520", 
solidHeader = T,
sliderInput("slider", "Number of observations:", 1, 100, 50))
)
)
)
server <- function(input, output) {
set.seed(122)
histdata <- rnorm(500)
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
}
shinyApp(ui, server)
like image 471
Ashmin Kaul Avatar asked Oct 29 '22 02:10

Ashmin Kaul


1 Answers

The answer in the comments did not work for me. After some trial and error, what worked was this:

dashboardBody(tags$head(tags$style(HTML('
.box {margin: 5px;}'
)))

Just include .box {margin: 5px;} in your HTML style tags.

like image 94
conv3d Avatar answered Nov 15 '22 06:11

conv3d