title: Multiple line chart using plotly r
body: <p>I have a data frame which I am trying to plot using plotly as multiple line chart.Below is how the dataframe looks like:</p>
  
  <pre><code>  Month_considered pct.x pct.y   pct
     &lt;fct&gt;            &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
   1 Apr-17            79.0  18.4  2.61
   2 May-17            78.9  18.1  2.99
   3 Jun-17            77.9  18.7  3.42
   4 Jul-17            77.6  18.5  3.84
   5 Aug-17            78.0  18.3  3.70
   6 Sep-17            78.0  18.9  3.16
   7 Oct-17            77.6  18.9  3.49
   8 Nov-17            77.6  18.4  4.01
   9 Dec-17            78.5  18.0  3.46
  10 Jan-18            79.3  18.4  2.31
  11 2/1/18            78.9  19.6  1.48
  </code></pre>
  
  <p>When I iterate through to plot multiple lines below is the code used.</p>
  
  <pre><code>colNames &lt;- colnames(delta)
  p &lt;-
    plot_ly(
      atc_seg_master,
      x = ~ Month_considered,
      type = 'scatter',
      mode = 'line+markers',
      line = list(color = 'rgb(205, 12, 24)', width = 4)
    )
  
  for (trace in colNames) {
    p &lt;-
      p %&gt;% plotly::add_trace(y = as.formula(paste0("~`", trace, "`")), name = trace)
  }
  
  p %&gt;%
    layout(
      title = "Trend Over Time",
      xaxis = list(title = ""),
      yaxis = list (title = "Monthly Count of Products Sold")
    )
  p
  </code></pre>
  
  <p>This is how the output looks like
  <a href="https://i.stack.imgur.com/rVE1v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rVE1v.png" alt="enter image description here"></a></p>
  
  <p>My question is how to remove <code>trace 0</code>  and <code>month_considered</code> to remove from the chart even though its not in colnames which I loop through to add the lines.</p>