library(plotly)
df=data.frame(
Roll_number=c(1,2,3,4,5,6,7,8,9,10),
Marks_Section1=c(85,84,76,88,67,81,91,85,92,88),
Marks_Section2=c(88,85,80,98,76,86,73,97,90,82),
Marks_Section3=c(80,74,76,87,80,82,77,84,74,58)
)
fig <-plotly::plot_ly(data = df,x = ~Roll_number,
y = ~Marks_Section1,name = "Section 1",
type = "scatter",mode = "lines+markers",
line=list(width=6,sash='dot', color="yellow")) %>%
add_trace(y = ~Marks_Section2, name = "Section 2",mode = "lines",
line = list(width = 5, dash = "dot", color="red")) %>%
add_trace(y = ~Marks_Section3, name = "Section 3",mode = "lines",
line = list(width = 4, dash = "dash", color="green")) %>%
layout(title="Customized Multiline Plot using Plotly",hovermode = "x unified")
fig