如何将Plotly漏斗图橙色柱间灰色区域改为白色?
Fixing the Gray Connector Area in Your Plotly Funnel Chart
Hey there! I see you want to swap out that gray space between your orange funnel bars for white—let's get that sorted for you right away.
The issue comes down to how you've defined the connector parameter currently. You’ve nested an extra list(color="white") inside fillcolor, which isn’t the correct syntax for Plotly’s funnel connector settings.
Here’s your adjusted code with the fix applied:
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"), # Fixed the connector fillcolor here connector = list(fillcolor = "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)'))) # View the updated plot funnel_plot
What changed?
- I replaced
connector = list(fillcolor =list(color="white"))withconnector = list(fillcolor = "white"). Plotly expects a direct color value (RGB string, hex code, or named color) for the funnel connector’sfillcolor—no extra nested list is needed. - Your existing
marker = list(..., width=0)setting is already perfect, as it removes any gray borders around the orange bars that might have added unwanted gray tones.
This adjustment will make the area between your orange funnel sections pure white, exactly what you’re aiming for!
内容的提问来源于stack exchange,提问作者Moniek
相关产品推荐
相关产品推荐

