Geom_sf with plotly

I can’t render plotly versions of maps made using ggplot2 with geom_sf. Other geoms work fine with plotly in my hands, e.g. bar charts, boxplots, and even geolocated points with custom hover labels. Even the simple example from one of Sievert’s articles does not work:

library(ggplot2)
library(plotly)
library(sf)
library(albersusa)

us_laea <- usa_sf("laea")
p <- ggplot() + geom_sf(data = us_laea)
ggplotly(p)

Any help would be appreciated.

1 Like

Same problem here. Did you get around it?

Tracebak:
Error: object of type ‘closure’ is not subsettable
5. aes2plotly(data, params, “size”)
4. geom2trace.GeomPath(d, params)
3. gg2list(p, width = width, height = height, tooltip = tooltip, dynamicTicks = dynamicTicks, layerData = layerData, originalData = originalData, source = source, …)
2. ggplotly.ggplot§

  1. plotly::ggplotly§

The article for reference: https://moderndata.plot.ly/learning-from-and-improving-upon-ggplotly-conversions/

Solved it by updating plotly::