I have a fluidPage layout simplified to this:
ui <- fluidPage(
div(h6("Built by ", tags$a(href="https://www.linkedin.com/in/kamille-elvstrøm-krause-3b1153109/", "Kamille Elvstrøm Krause"), " & ", tags$a(href="https://www.linkedin.com/in/carina-skaarup-3b049364/", "Carina Skaarup")),
tags$a(href = "http://tropicalpharmacology.com", img(src = "TPL_logo_black.jpg", width = "479px", height = "100px")),
tags$a(href = "http://www.dtu.dk/english/education", img(src = "DTU_logo.jpg", width = "220px", height = "100px", align = "right"))),
navbarPage("",
tabPanel("About")
tabPanel("STAB Profiles",
fluidRow(
column(width = 12,
h2("Snake Toxin and Antivenom Binding Profiles"),
br(),
fluidRow(
column(width = 3,
h3("Binding Profile Specifics"),
selectInput(...)),
column(width = 9,
tabsetPanel(type = "tabs",
tabPanel(title = "Binding Profile",
fluidRow(
column(width = 9,
# Plot (facet):
br(),
uiOutput(outputId = "ui_plot"),
style = 'height:800px; overflow-y: scroll'),
column(width = 3,
# Legend:
br(),
uiOutput(outputId = "ui_legend"))
)
),
tabPanel(title = "Chosen Variables Data Table",
br(),
downloadButton('downloadData1', 'Download Data'),
br(),
br(),
dataTableOutput(outputId = "table1"),
style = 'height:800px; overflow-x: scroll; overflow-y: scroll'),
tabPanel(title = "Chosen Data Points Data Table",
br(),
downloadButton('downloadData2', 'Download Data'),
br(),
br(),
dataTableOutput(outputId = "table2"),
style = 'height:800px; overflow-x: scroll; overflow-y: scroll')
)
)
)
)
)
)
)
)
This is just to give you an idea of the size (height) of my UI.
I have a VERY long script so I'm really trying to simplify!
My problem is with the "# Plot (facet):" part.
The server part of the "uiOutput(outputId = "ui_plot")" call looks like this:
server <- function(input, output, session) {
...
values <- reactiveValues()
plot_height <- function() {
values$facet_count <- as.numeric(length(unique(data_subset()$UniprotID)))*200
return(values$facet_count)
}
output$plot <- renderPlot({
ggplot(data = data_subset(), aes(x = Position_start, y = Signal, color = Antivenom)) +
geom_point() + geom_line() +
facet_wrap(~UniprotID, ncol = 1)
})
output$ui_plot <- renderUI({
plotOutput("plot",
height = plot_height())
})
}
Notice the height of each facet plot is set to 200 px in the "plot_height" function.
I would like this height to be 350 px as the plots otherwise become to small.
BUT, now here is the problem:
The data_subset process can maximum generate 80 faceted plots with the selecting inputs I have, but when this happens the figure will only display at a maximum facet plot height of 200 px when the app is published to the shinyapps.oi server. It works just fine when running the app locally in RStudio. Any number set above 200 will display the following error message in the published app, where the plot was supposed to be:
"Error: An error has occurred. Check your logs or contact the app author for clarification."
My conclusion is that there must be a maximum total height of the page the online shiny server can portray, and if your plot exceeds this it cannot show the plot.
80 plots times a height of 200 px gives a total height of 16000 px for the total ggplot2 figure, which apparently is the max height it can show when published on the shinyapps.oi server.
I have published the app with the height of 200 px per facet on this link:
https://snake.shinyapps.io/STAB_Profiles/
And the app with the height of 350 px per facet on this link:
https://snake.shinyapps.io/Snake_App/
To get the maximum amount of plots choose "Naja" in the "Snake Genus" drop-down menu.
The only difference between the two published apps is the facet height, and one works just fine while the other one portrays error messages at three genus choices when species is not specified.
My question is:
Is there any way to get around this problem so I can get more height on each facet plot, without reducing the number of facet plots in the figure?