title: R plotly how to use add_trace() to a plot with color grouping
body: <p>How can I get the following code to draw a line between (1,2) and (3,2)?</p>
  
  <pre><code>plot_ly(x=c(1,2,3),
          y=c(1,2,3),
          type='scatter',
          mode='markers',
          color=as.factor(c('a','b','c')))%&gt;%
    add_trace(x=c(1,3,NA),
              y=c(2,2,NA),
              mode='lines')
  </code></pre>
  
  <p>The solution here <a href="https://stackoverflow.com/questions/44915844/r-plotly-add-trace-to-a-chart-with-color-groups">R plotly add_trace to a chart with color groups</a> doesn't work. Thanks.
  <a href="https://i.stack.imgur.com/11lsv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/11lsv.png" alt="enter image description here"></a></p>
  
  <p>Edit: Using <code>inherit=FALSE</code> does the job (thanks Jonny Phelps)</p>
  
  <pre><code>plot_ly(x=c(1,2,3),
          y=c(1,2,3),
          type='scatter',
          mode='markers',
          color=as.factor(c('a','b','c')))%&gt;%
    add_trace(x=c(1,3),
              y=c(2,2),
              mode='lines',
              inherit = FALSE,
              line=list(color='black'))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/opZgk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/opZgk.png" alt="enter image description here"></a></p>