2015-08-30 43 views
3

如何隱藏以下從他們的網站取得的陰謀示例中的顏色條?R - 密謀 - 隱藏顏色條

df <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2014_world_gdp_with_codes.csv') 

# light grey boundaries 
l <- list(color = toRGB("grey"), width = 0.5) 

# specify map projection/options 
g <- list(
    showframe = FALSE, 
    showcoastlines = FALSE, 
    projection = list(type = 'Mercator') 
) 

plot_ly(df, z = GDP..BILLIONS., text = COUNTRY, locations = CODE, type = 'choropleth', 
     color = GDP..BILLIONS., colors = 'Blues', marker = list(line = l), 
     colorbar = list(tickprefix = '$', title = 'GDP Billions US$'), 
     filename="r-docs/world-choropleth") %>% 
    layout(title = '2014 Global GDP<br>Source:<a href="https://www.cia.gov/library/publications/the-world-factbook/fields/2195.html">CIA World Factbook</a>', 
     geo = g) 

該圖引用不提供答案:https://plot.ly/r/reference/#colorbar。我可以通過編輯圖來隱藏顏色條,但是我想在R代碼中控制它。

回答

5

另一種選擇是使用%>% hide_colorbar()

1

我在這裏結束了在JavaScript中尋找它。對於JS使用showscale :false圖表類型之後: -

showscale :false, 
    type: 'heatmap',