我想知道如何使用R中的plotly更改以下漏斗图中每个条形之间区域的颜色。我已经阅读了plotly网站上的文档,但它仅演示了如何格式化勾勒出该区域轮廓的“线”。我如何实际更改该区域的颜色(下图中浅蓝色的位)?
绘图的代码如下(这是plotly网站上的示例):
fig <- plot_ly()
fig <- fig %>%
add_trace(
type = "funnel",
y = c("Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent"),
x = c(39, 27.4, 20.6, 11, 2))
fig <- fig %>%
layout(yaxis = list(categoryarray = c("Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent")))
fig
可以通过
add_trace(connector = list(fillcolor))
设置。
library(plotly)
plot_ly() %>%
add_trace(
type = "funnel",
y = c("Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent"),
x = c(39, 27.4, 20.6, 11, 2),
connector = list(fillcolor = "black")) %>%
layout(yaxis = list(categoryarray = c("Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent")))