Make subplots of plot_ly graph in R
问题 I have a dataframe, which can be created in this way: x = data.frame(metrics=c("type1", "type1", "type1", "orders", "orders", "orders", "mean","mean","mean"), hr=c(6,7,8,6,7,8,6,7,8), actual=c(14,20,34,56,12,34,56,78,89)) I tried to draw a scatterplot using plot_ly function. I wrote a function for it (i need it to be a function): plot <- function(df){ gp <- df %>% plot_ly( x = ~ hr, y = ~ actual, group = ~ metrics, hoverinfo = "text", hovertemplate = paste( "<b>%{text}</b><br>", "%{xaxis