title: Plotly legend next to each subplot, Python
body: <p>After noticing that there was no answer to this question at the moment, I would like to know if anyone has an idea how to:</p>
  
  <ol>
  <li>Have a legends for each subplot.</li>
  <li>Group legends by name. (Ex: for different subplots, all have the same two curves but with different values).</li>
  </ol>
  
  <p>Here's my Plotly script:</p>
  
  <pre><code>from plotly import tools
  import plotly.plotly as py
  import plotly.graph_objs as go
  import plotly
  nom_plot=[]
  
  trace1 = go.Scatter(x=[1, 2, 3], y=[4, 5, 6],name='1',showlegend=True)
  nom_plot.append('GRAPH 1')
  trace2 = go.Scatter(x=[20, 30, 40], y=[50, 60, 70],name='2',yaxis='y2')
  nom_plot.append('GRAPH 2')
  trace3 = go.Scatter(x=[300, 400, 500], y=[600, 700, 800],showlegend=False)
  nom_plot.append('GRAPH 3')
  trace4 = go.Scatter(x=[4000, 5000, 6000], y=[7000, 8000, 9000])
  nom_plot.append('GRAPH 4')
  trace5 = go.Scatter(x=[20, 30, 40], y=[50, 60, 70])
  nom_plot.append('GRAPH 5')
  
  print(trace1)
  
  
  
  fig = tools.make_subplots(rows=4, cols=2, subplot_titles=(nom_plot))
  
  fig.append_trace(trace1, 1, 1)
  fig['layout']['xaxis1'].update(title='xaxis 1 title')
  fig.append_trace(trace2, 1, 1)
  fig.append_trace(trace3, 2, 1)
  fig.append_trace(trace4, 2, 2)
  fig['layout']['yaxis3'].update(title='yaxis 3 title')
  fig.append_trace(trace5, 3, 1)
  
  
  fig['layout']['yaxis2'].update(
      overlaying='y1',
      side='right', 
      anchor='x1',
      # domain=[0.15, 1],
      range=[2, 6],
      # zeroline=False,
      showline=True, 
      showgrid=False,
      title='yaxis 3 title'
  )
  
  fig['layout'].update(height=1000, width=1000, title='Multiple Subplots' +' with Titles')
  
  
  plotly.offline.plot(fig, filename='multiple-y-subplots6.html')
  </code></pre>
  
  <p>This what I obtain (Using Plotly Script above):</p>
  
  <p><a href="https://i.stack.imgur.com/009Fd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/009Fd.png" alt="Exemple Made by using Plotly"></a></p>
  
  <p>And this is what I want (Made by Pygal):</p>
  
  <p><a href="https://i.stack.imgur.com/t8sEu.png" rel="noreferrer"><img src="https://i.stack.imgur.com/t8sEu.png" alt="Exemple Made by using Pygal"></a></p>