1

I am looking for some help to add a horizontal line in the plotly graph. I tried using add_trace(y=75000000, mode="line") command. But the problem is the lines are coming as legend for all the regions given in the color command. My code looks like below.

plot_ly(limit, x = ~cycle_Report, y = ~Amount,color = ~Region, colors = c('#BF382A', '#0C4B8E')) %>%
    add_markers() %>%
    #geom_hline(aes(y=75000000)) %>%
    add_trace(y=75000000,mode ='lines', color = list('red')%>%
    layout(scene = list(xaxis = list(title = 'cycle Report'),
                        yaxis = list(title = 'cycle Amount')))

I simply need to add a horizontal line at 75000000 in y-axis with Red color and the text for that line without forming separate legends.

Lak023
  • 33
  • 1
  • 2
  • 5
  • 1
    Possible duplicate of [Horizontal/Vertical Line in plotly](https://stackoverflow.com/questions/34093169/horizontal-vertical-line-in-plotly). See 2nd answer. – Maximilian Peters Aug 22 '17 at 12:07
  • Does correcting the typo give you the desired output? Would be great if you could provide a reproducible example. – Prradep Aug 22 '17 at 13:46

0 Answers0