我正在尝试将datatable的两个变量(可用和不可用)放在条形图中,分别表示百分比(y轴)和x轴的日期(绘图中的颜色以区分服务)。这是我的数据表,有各自的变量。enter image description here
我正在尝试将这两个变量组合到一个图中,同时考虑到每个服务(系列)。此时此刻,我只得到了这个:enter image description here
发布于 2020-04-20 21:53:28
我尝试在R中使用plotly来做到这一点。
barstack<-plot_ly(Servicelevel, x=Servicelevel$Date, y=Servicelevel$Available,
color=Servicelevel$Series,type = "bar")
barstack <- barstack %>% add_trace(y = Servicelevel$Unavailable)
barstack<-barstack %>%
layout(title = "Percentage of Availability over time",
yaxis = list(title = 'Availability (%)',
tickformat = ".2%"),
xaxis=list(title='Date'), barmode = 'stack')结果是:result
https://stackoverflow.com/questions/61322837
复制相似问题