Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Plotly not rendering in R viewer or browser

I created a plotly scatter using the shell provided by plotly. Script seen below use to work. Tried to use it recently and the plot no longer renders within RStudio or when viewing in a new window (i.e. browser). End state is to create a shiny app that will adjust scatter based on start and end dates. Want to ensure plot renders prior to building the shiny app.

I’ve tried restarting R and uninstalling/reinstalling plotly. No errors when the below code runs.

library(plotly)

p2c_Map_Data$text <- with(p2c_Map_Data,
paste(State, City, Zip, SalesCount, CustomerProspect,RevenuesProspect,

’, “Days to Convert”, MedianConversionTimeDays,’
’,
“Touchpoint Count”, MedianPathLength, “
”,
“Sales”, Revenues))

specify some map projection/options

g <- list(
scope = ‘usa’,
projection = list(type = ‘albers usa’),
showland = TRUE,
landcolor = toRGB(“gray95”),
subunitcolor = toRGB(“gray85”),
countrycolor = toRGB(“gray85”),
countrywidth = 0.5,
subunitwidth = 0.5
)

p <- plot_geo(p2c_Map_Data, lat = ~latitude, lon = ~longitude) %>%
add_markers(
text = ~paste(p2c_Map_Data$State, p2c_Map_Data$City, p2c_Map_Data$Zip,
paste(“Sales Count:”, p2c_Map_Data$SalesCount),
paste(“CustomerProspect:”, p2c_Map_Data$CustomerProspect),
paste(“Revenues:”, p2c_Map_Data$Revenues),
paste(“RevenuesProspect:”, p2c_Map_Data$RevenuesProspect),
paste(“Days to Convert:”, p2c_Map_Data$MedianConversionTimeDays),
paste(“Touchpoint Count:”, p2c_Map_Data$MedianPathLength), sep = “
”),
color = ~p2c_Map_Data$Revenues, symbol = I(“square”), size = I(10), hoverinfo = “text”) %>%
colorbar(title = “Revenues”) %>%
layout(title = ‘Map Data Report
FY 16’, geo = g)