Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Background map on 3D scatter plot

I’m working on a 3D scatter plot, where the x and y correspond to latitude and longitude coordinates.
So far I was able to do it with this code:

p <- plot_ly(testlist$nodes, x = ~Latitude, y = ~Longitude, z = ~freq, color = ~freq, colors = c('#BF382A', '#0C4B8E')) %>%
  add_markers(size = ~freq, text = ~CITY,
              projection = list(x = list(opacity = 0.3, show = TRUE),
                                y = list(opacity = 0.3, show = TRUE)))

Here’s a screenshot to show it.

However, I would like to plot a US map, on the z=0 projection (bottom of the graph). Is there any way to do so? It can be faded, and it’s mainly for reference.

Looks cool! I haven’t seen anyone do this in R. It’s definitely possible- your best bet is probably to draw the US as a 3d line chart on the x-y plane. You could get an R developer support plan for more help from Plotly: https://support.plot.ly/libraries/r

also looking for an answer to this! bump!

@empet worked out a solution in Python here:

https://plot.ly/~empet/14397/plotly-plot-of-a-map-from-data-available/

Should be easy to translate to R.