plotly::plot_geo fitting parent div in Shiny

39 views Asked by At

I am struggling to create a map in plotly that fully fits the height and width of a card in Shiny. See a minimum reproducible example below and a screenshot of what I would like to achieve. Any advice on how to proceed would be much appreciated.

library(shiny)
library(plotly)
library(bslib)

ui <- fluidPage(
  card(plotlyOutput("plot", width = "100%", height = "100%"))
)

server <- function(input, output, session) {
  output$plot <- renderPlotly({
      plot_geo(type = 'scattermapbox') %>% 
      layout(
        showlegend = FALSE,
        paper_bgcolor="#F0F9FE",
        geo = list(scope = 'world'))
})
}
shinyApp(ui, server)

Screenshot displaying in blue the card that I would like to fully fit with the map

0

There are 0 answers