尝试在条形图上添加误差线。
library(plotly)
library(plyr)
year <- c("1993","1994","1995","1996")
incident <- c(123.2,489.2,281.3,892.1)
lower_int <- c(32.1,23.1,11.1,34.2)
upper_int <- c(45.3,43.5,25.6,59.0)
data <- data.frame(year, incident, lower_int, upper_int)
fig <- plot_ly(data, x = ~year, y = ~incident, type = 'bar',
error_y = ~list(y_min = ~lower_int,
y_max = ~upper_int))
fig
这段代码只绘制条形图,但间隔并没有显示在条形图上。
2条答案
按热度按时间b4lqfgs41#
您可以使用
array
和arrayminus
并删除列表前面的~
wydwbb8l2#
请更新阵列代码,如下所示
数组=下限整数-上限整数