i'm working on R and i just made a plot. The thing is that i need to fill in the area between two traces but not all along the range.
I found the arguments fill="...." but it fills all plots and i need to control between which trace i fill in area and to set a range shorter than the plot range.
So can you please help me to do it ?
A=c(0,1,2,3,4,5,6,5,4,3,2,1,0)
B=rep(3,13)
sem=c(0:12)
p <- plot_ly(data, x = sem[order(sem)],
y = A,name = 'A', type = 'scatter',
mode = 'lines') %>%
add_trace(y = B,name = 'B',
mode = 'lines+markers') %>%
layout(title = sprintf("Effect",
font=list(
family = "arial",
size = 12,
color = 'black'),
yaxis = list(zeroline = FALSE,title="Weight(T)"),
xaxis = list(range=c(-10:25),zeroline = FALSE,title="week"),
legend=list(
font = list(
family = "sans-serif",
size = 12,
color = "#000"),
bgcolor = "#E2E2E2",
bordercolor = "#FFFFFF",
borderwidth = 2))