✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

Ggplot2 Map fine in R Shiny, but fails to render as a plotly

Below is my code to render a Plotly plot in R Shiny. Other plots in my code aslo using plotly_build are working just fine but this plot lags for a long time and then produces a “numbers of columns of arguments do not match” error.

I suspect geom_map is throwing plotly some unique challenges. Any idea why I can’t render this code as a plotly?


**gg <- gg + geom_map(data=data, map=data, aes(x=long, y=lat, map_id=region), fill="#ffffff", color="#ffffff", size=0.15)**

** gg <- gg + geom_map(data=data, map=data, aes_string(fill=input$zz,map_id=“region”), color="#ffffff", size=0.15)**
** gg <- gg + scale_fill_continuous(low=‘white’, high=‘darkred’, guide=‘colorbar’)**
** gg <- gg + labs(x=NULL, y=NULL)**
** gg <- gg + coord_map(“albers”, lat0 = 39, lat1 = 45) **
** gg <- gg + theme_nothing(legend=TRUE)**
** gg<- plotly_build(gg)**
** gg })**