To give you a hand with the reprex part, this would be a simplified version of your app that shows your issue, that if I understand it correctly is the size of your plot when the filter is applied. (I'm not giving you a solution because I have never used html tags for sizing my plots so I don't know how to do it).
library(ggplot2)
library(dplyr)
library(shiny)
df <- data.frame(A = as.factor(c("asd", "fsd", "gs", "asd", "sf", "dfg", "sdfg",
"fgdsgd", "gdfgd", "gdfgd", "asd", "sf", "dfg",
"sdfg", "dfg")),
B = c(29L, 24L, 46L, 50L, 43L, 29L, 32L, 24L, 35L, 39L, 33L, 47L, 53L, 26L, 31L),
C = as.factor(c("sf", "gfd", "asd", "gfg", "fg", "er", "tr", "qw",
"gfg", "fg", "er", "tr", "sf", "sf", "gf")),
D = c(36L, 56L, 39L, 26L, 56L, 35L, 27L, 31L, 33L, 45L, 34L, 27L, 43L, 40L, 56L),
E = as.factor(c("sf", "gd", "g", "gd", "fg", "gtd", "tr", "qw",
"gfg", "fg", "er", "tr", "sf", "sf", "gf")),
F = c(44L, 34L, 37L, 23L, 37L, 51L, 28L, 36L, 33L, 31L, 39L, 43L, 25L, 37L, 43L),
num = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L))
MyList <- vector(mode = "list")
for (i in names(df)) {
MyList[[i]] <- df[, i]
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
fluidRow(column(h6(selectInput("state", "Filters", choices = c("", MyList))), width = 5, offset = 0)),
width = 1000
),
mainPanel(
h5(plotOutput("Plot", width = "1000px", height = "1000px"), width = 1000)
)
)
)
server <- function(input, output, session) {
f_data <- reactive({
if (input$state == "") {
df
} else {
df %>%
filter_if(
.predicate = is.factor,
.vars_predicate = any_vars(. == input$state)
)
}
})
output$Plot <- renderPlot({
f_data() %>%
ggplot(aes(x = num, y = B, fill = A)) +
geom_line() +
facet_wrap("A", ncol = 1, nrow = 8, scales = "free")
})
}
shinyApp(ui, server)