title: Sharing same legends for subplots in plotly
body: <p>I've two plots created in the same figure using <code>subplots</code> in plotly.</p>
  
  <pre><code>import plotly.graph_objects as go
  import numpy as np
  import pandas as pd
  from plotly.subplots import make_subplots
  
  df = pd.DataFrame(np.random.randint(0, 100, size=(20, 5)), columns=list('tABCD'))
  df2 = pd.DataFrame(np.random.randint(0, 100, size=(20, 5)), columns=list('tABCD'))
  
  fig = go.Figure()
  fig = make_subplots(rows=1, cols=2)
  
  fig.add_trace(go.Scatter(
                  x=df.t,
                  y=df['A'],
                  name="1",
                  line_color='deepskyblue',
                  opacity=0.8,
                  legendgroup='group1'),
                  row=1, col=1
                  )
  
  fig.add_trace(go.Scatter(
                  x=df.t,
                  y=df['B'],
                  name="2",
                  line_color='dimgray',
                  opacity=0.8,
                  legendgroup='group2'),
                  row=1, col=1
                  )
  
  fig.add_trace(go.Scatter(
                  x=df.t,
                  y=df['C'],
                  name="3",
                  line_color='blue',
                  opacity=0.8,
                  legendgroup='group3'),
                  row=1, col=1
                  )
  
  fig.add_trace(go.Scatter(
                  x=df.t,
                  y=df['D'],
                  name="4",
                  line_color='red',
                  opacity=0.8,
                  legendgroup='group4'),
                  row=1, col=1
                  )
  
  fig.add_trace(go.Scatter(
                  x=df2.t,
                  y=df2['A'],
                  name="1",
                  line_color='deepskyblue',
                  opacity=0.8,
                  legendgroup='group1'),
                  row=1, col=2
                  )
  
  fig.add_trace(go.Scatter(
                  x=df2.t,
                  y=df2['B'],
                  name="2",
                  line_color='dimgray',
                  opacity=0.8,
                  legendgroup='group2'),
                  row=1, col=2
                  )
  
  fig.add_trace(go.Scatter(
                  x=df2.t,
                  y=df2['C'],
                  name="3",
                  line_color='blue',
                  opacity=0.8,
                  legendgroup='group3'),
                  row=1, col=2
                  )
  
  fig.add_trace(go.Scatter(
                  x=df2.t,
                  y=df2['D'],
                  name="4",
                  line_color='red',
                  opacity=0.8,
                  legendgroup='group4'),
                  row=1, col=2
                  )
  
  fig.write_html('ts.html', auto_open=True)
  </code></pre>
  
  <p>Output: 
  <a href="https://i.stack.imgur.com/34IEp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/34IEp.png" alt="enter image description here"></a></p>
  
  <p>I want to share the same legends for both subplots. So, I tried specifying a legend group (<a href="https://community.plot.ly/t/graphs-sharing-same-legend/12476/5" rel="noreferrer">ref</a>). It works, but duplicate labels appear</p>
  
  <p>Any suggestions on how to remove the duplicates will be helpful </p>