R-绘图-隐藏颜色条 [英] R - plotly - hide colorbar

查看:56
本文介绍了R-绘图-隐藏颜色条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在下面从他们网站上绘制的示例中隐藏颜色栏?

How can I hide the colorbar in the following plotly example taken from their website?

    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代码中对此进行控制.

The figure reference does not provide an answer: https://plot.ly/r/reference/#colorbar. I can hide the colorbar via editing the graph, but I would like to control this in the R code.

推荐答案

尝试在跟踪级别添加 showscale = FALSE .

https://plot.ly/r/reference/#heatmap-showscale

这篇关于R-绘图-隐藏颜色条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆