title: Plotly express line chart - get default colors (how to color lines as specified by a dictionary object?)
body: <p>I have a data frame of a multivariate time series, for which I've created a interactive plotly express plot. I'm adding vertical lines at particular locations specified by a dictionary, each line associated to one of the time series, and wish to set the line color to agree with that of the corresponding variable. In essence, in the picture below, each vertical segment can be identified with one of Fp1 or Fp2 and I want to color it as red or black accordingly:</p>
  
  <p><a href="https://i.stack.imgur.com/TC5vQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TC5vQ.png" alt="enter image description here"></a></p>
  
  <p>First I plot the data frame, where X is my time series matrix, plotly.express has been imported as px, pandas imported as pd, and channels=['Fp1','Fp2']:</p>
  
  <pre><code>df=pd.DataFrame(X,columns=channels)
  df['id'] = df.index
  df = pd.melt(df, id_vars='id', value_vars=df.columns[:-1])
  fig = px.line(df, x='id', y='value', color='variable',labels = {'id':'time (20K~100 sec)', 
  'value':'millivolts','variable':'channel'},title='Patient')
  </code></pre>
  
  <p>Subsequent calculations yield a dictionary, HFOs, where each key corresponds is one of my two channels, and each value is a list of times, e.g. something of the form</p>
  
  <pre><code>HFOs={'Fp1':[500,....,10500],'Fp2':[800,...11000]}
  </code></pre>
  
  <p>I then created my lines and added them to the figure:</p>
  
  <pre><code>for channel,times in HFOs.items():
      for t in times:        
          fig.add_shape(type='line',yref="y",xref="x",
          x0=t,y0=df['value'].min()*1.2,x1=t,y1=df['value'].max()*1.2,line=dict(color='black', 
          width=.25))
          fig.add_trace(go.Scatter(x=[t],y= 
          [df['value'].max()*1.5],mode='text',showlegend=False))    
  fig.show()
  </code></pre>
  
  <p>This creates the image shown above. How do I modify 
       line=dict(color='black',width=.25) 
  to change the color to what I want? I wish for the vertical lines at times [500,....,10500]to be blue and times [800,...11000] to be red. (Of course, in the future, there will be many more channels.)</p>
  
  <p>I tried replacing 'black' with 'variable" but that, not surprisingly, just resulted in an error message. I feel there must be a very simple way to achieve my goal.</p>