在r查看器或'在新窗口中查看'中无法绘制地图

时间:2017-04-26 18:25:24

标签: r

有阴谋问题。情节相当新鲜。我的问题:下面的脚本(模板直接从plotly的网站上获取)不会在R studio viewer中呈现剧情分散。我尝试在新窗口中打开,如下所述:Plotly Maps Not Rendering in R

以下代码之前正在工作(即在“查看新窗口”中呈现)。试图昨天和今天早上使用它;我得到的只是标题和颜色条。

 library(plotly)

    p2c_Map_Data$text <- with(p2c_Map_Data, 
                          paste(State, City, Zip, SalesCount, CustomerProspect,RevenuesProspect,
                          '<br>', "Days to Convert", MedianConversionTimeDays,'<br>',
                          "Touchpoint Count", MedianPathLength, "<br>",
                          "Sales", Revenues))

#give state boundaries a border
    l <- list(color = toRGB("white"), width = 2)

# 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 = "<br>"),
      color = ~p2c_Map_Data$Revenues, symbol = I("square"), size = I(10),      hoverinfo = "text") %>%
      colorbar(title = "Revenues") %>%
      layout(title = 'Map Data Report<br />FY 16', geo = g) 

0 个答案:

没有答案