gpt4 book ai didi

R - 绘图 - 隐藏颜色条

转载 作者:行者123 更新时间:2023-12-02 03:00:42 32 4
gpt4 key购买 nike

如何在以下取自其网站的绘图示例中隐藏颜色条?

    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 代码中控制它。

最佳答案

另一种选择是使用%>% hide_colorbar()

关于R - 绘图 - 隐藏颜色条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32297832/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com