I’m looking for a solution to this StackOverflow post.
Also, I wanted to note that this issue does not seem to apply to bar charts. When I convert the reprex from the StackOverflow post to a bar chart, the error bars are applied correctly:
reprex <- tibble(year = as_factor(c(2013, 2014, 2015, 2016, 2017, 2018, 2019)),
rate = c(3, 2, NA, NA, 0.153, 0.123, NA),
lcl = c(2, 1, NA, NA, 0.0813, 0.0612, NA),
ucl = c(4, 5, NA, NA, 0.261, 0.219, NA)) %>%
mutate(difflow = rate-lcl,
diffhi = ucl-rate)
plot <- plot_ly()
plot <- add_trace(plot,
data = reprex,
x = ~year,
y = ~rate,
type = "bar",
error_y = ~list(type = "data",
array = na.omit(ucl-rate),
arrayminus = na.omit(rate-lcl),
color = "black"))
plot