A faceted plot can be made directly with plotly but I have almost no experience working directly with plotly. The following code begins to make such a plot but the result has many problems. Among them are that the x axis tick mark labels are terrible and there is no legend. If I turn the legend on for each subplot, I get 5 copies of the legend. I'm sure there is a way to prevent that. The code may be the silliest possible way to make such a plot with plotly. As I said, I do not use that package.
library(plotly)
DAT <- read.csv("~/R/Play/file.csv")
DAT <- DAT %>%
mutate(Metrics = factor(Metrics,
levels = c("OEE", "BreakDown", "ChangeOver", "Industrialization",
"NonPlannedStop", "PlannedStop", "Quality", "Scrap")))
ThePlot <- . %>% plot_ly() %>%
add_trace(x = ~Date, y = ~Percent, color = ~Metrics, type = "bar") %>%
add_annotations(
text = ~unique(Line),
x = 0.5,
y = 1.10,
yref = "paper",
xref = "paper",
xanchor = "middle",
yanchor = "top",
showarrow = FALSE,
font = list(size = 10)
) %>%
layout(barmode = "stack", showlegend = FALSE)
DAT %>% group_by(Line) %>%
do(p = ThePlot(.)) %>%
subplot(nrows = 2, shareX = TRUE, shareY=TRUE)