I have an R markdown document using shiny with 6 or 7 plots. They all display until the 7th plot, which is a leaflet map, which doesn't display - when I 'run document' there is a big empty space at the bottom.

However, I have verified that the leaflet code works by running it in console, in another markdown document, and by moving it to the top of the current document - in the latter instance it does indeed render properly once placed at the top. But then the plot which is now at the bottom gets cut off instead!

I'm fairly new to markdown, but I wondered for example whether there is a maximum number of lines you can have in your document, and whether this could explain what's going on?

The global environment chunk is set simply as follows. I can post further code if helpful.

{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE)

To reiterate, the plot succeeds if placed at the top of my page but not the bottom after my vanilla plots. If placed at the bottom, nothing after the leaflet appears either - there's just a massive gap of nothing.

  • I have this same problem and have been unable to find any answers. But it's not a maximum number of lines issue. Nov 18, 2019 at 17:35
  • 1
    @AdrianMartin Perhaps post your own question with a reprex? See Also: github.com/rstudio/leaflet/issues/623
    – GISHuman
    Nov 18, 2019 at 18:40
  • I actually was able to figure it out and it was not a leaflet problem after all: plotly 4.9.0 was causing the problem. I reverted to plotly 4.8.0 and it resolved. (i had both plotlys and leaflets in a flexdashboard) github.com/ropensci/plotly/issues/1546 Nov 19, 2019 at 21:18


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.