调整漏斗plot_ly对象的颜色

时间:2020-07-09 14:27:49

标签: r plotly r-plotly

我使用plotly创建了一个漏斗图对象,请在下面找到我的代码。此图看起来非常好,除了我希望条形图之间的灰色区域是白色而不是现在的灰色。

有人可以帮我调整不同橙色条之间的颜色吗?

library(plotly)

funnel_data <- data.frame(x = c(90, 75, 40, 20), 
                          y = c("Aided", "Familiarity", "Consideration", "Preference"))

funnel_plot <- funnel_data %>%
  plot_ly() %>%
  add_trace(type = "funnel",
            y = y,
            x = x,
            textposition = "inside",
            textinfo = "value",
            opacity = 1,
            marker = list(color = c("rgb(255,098,000)", "rgb(255,098,000)",
                                    "rgb(255,098,000)", "rgb(255,098,000)"), width=0), 
            textfont = list(family = "ING me", size = 14, color = "white"),
            connector = list(fillcolor =list(color="white"))) %>%
  layout(yaxis = list(categoryarray = c("Aided", "Familiarity", "Consideration", "Preference"),
                      tickfont =list(family = "ING me", size = 12, color = 'rgb(105, 105, 105)')),
         xaxis = list(tickfont =list(family = "ING me", size = 12, color = 'rgb(105, 105, 105)')),
         legend =list(textfont = list(family = "ING me", size = 12, color = 'rgb(105, 105, 105)')))
##
funnel_plot 

0 个答案:

没有答案