I want to be able to restyle first bar (base) to color gray.
I’m not sure if is possible restyle that specific bar?
In this example is green color. I want to restyle to same as totals.
library(plotly)
y = c(40, 10, 10, 0, -10, -10, 0, 10, 10, 0, -10, 0)
x = c("start", "1-increasing", "2-increasing", "1-subtotal",
"1-decrease", "2-decrease", "2-subtotal",
"3-increase", "4-increase",
"3-subtotal", "3-decrease",
"end")
measure = c("relative", "relative", "relative",
"total", "relative", "relative", "total",
"relative", "relative", "total", "relative",
"total")
data = data.frame(x=factor(x,levels = x), y, measure)
p <- plot_ly(data, x = ~x, y = ~y,
measure = ~measure,
type = "waterfall",
base = 0,
decreasing = list(marker = list(color = "Amber",
line = list(color = "red",
width = 1))),
increasing = (marker = list(color = "green")),
totals = list(marker = list(color = "gray", line = list(color = "gray", width = 1))),
showlegend = TRUE # FALSE
)
p <- p %>%
layout(title = "whaterfall")
p