I have done a multiple subplot. Here is my code:
m <- list(
#l = 50,
# r = 50,
b = 200,
#t = 100,
pad = 0
)
ma <- list(
#l = 100,
b = 100,
# t = 200,
pad = 0
)
p5<-plot_ly(moving_avg,x=~Time,y=~Moving_Average3,type="scatter" ,mode="lines",name ="Memory")%>%
add_trace(x=~Time,y = ~Moving_Average_Cpu3,mode="lines",yaxis = "y2",name ="CPU")%>%
layout(yaxis2 = list(overlaying = "y", side = "right"))%>%
layout(
title = "CPU VS MEMORY(MOVING AVERAGE)",
xaxis = list(
title = "",
zeroline=TRUE),
yaxis = list(
title = "MEMORY(%)",
zeroline=TRUE),
yaxis2 = list(
title = "CPU(%)",
zeroline=TRUE)
)%>%
layout(margin=m)
p6<-plot_ly(moving_avg,x=~Time,y=~Moving_Average3,type="scatter" ,mode="lines",name ="Memory")%>%
add_trace(x=~Time,y = ~Moving_Average_Cpu3,mode="lines",yaxis = "y2",name ="CPU")%>%
layout(yaxis2 = list(overlaying = "y", side = "right"))%>%
layout(
title = "CPU VS MEMORY(MOVING AVERAGE)",
xaxis = list(
title = "",
zeroline=TRUE),
yaxis = list(
title = "MEMORY(%)",
zeroline=TRUE),
yaxis2 = list(
title = "CPU(%)",
zeroline=TRUE)
)%>%
layout(margin=m)
subplot(p5,p6,nrows=1,which_layout = "merge", margin = 0.07,titleX = F, titleY = TRUE)%>%
layout(margin=ma)
But as you can all see in the image,in the graphs of both the plots the y axis 2 is getting hidden.
How can i resolve this issue?