title: Is there a way to breakdown a legend of plotly python for combined chart?
body: <p>As in subject of my question. I was trying few approaches to solve this issue, but I have run out of ideas. How can I display in legend 12 small rectangles with symbology of individual month (and still keep symbologies of lines, or move them to another legend box in top right corner). I'm interested in plotly, but matplotlib and seaborn will be also appreciate.</p>
  <p><img src="https://i.stack.imgur.com/p1Zya.png" alt="image" /></p>
  <p>Here's my current code(without data preparaing):</p>
  <pre><code>trace1 = go.Bar(x=df1['Week'], y=df1['Totals'], marker = dict(color=df1['Colour']))  
  trace2 = go.Scatter(x=df1['Week'], y=df1['Quantity'], name='Quantity',  
      mode = 'markers+lines',  
      marker=dict(color='rgb(255, 0, 0)', size=7, symbol = 'diamond'))  
  trace3 = go.Scatter(x=df1['Week'], y=df1['InvoiceNo'], name='Invoices',  
      mode = 'markers+lines', yaxis='y2',   
      marker=dict(color='rgb(255, 255, 0)', size=7, symbol = 'hexagon'))  
  trace4 = go.Scatter(x=df1['Week'], y=df1['CustomerID'], name='No. of Customers',  
      mode = 'markers+lines', yaxis='y2',   
      marker=dict(color='rgb(0, 255, 0)', size=5, symbol = 'square'))  
  fig = make_subplots(specs=[[{&quot;secondary_y&quot;: True}]])  
  fig.add_trace(trace1)  
  fig.add_trace(trace2,secondary_y=False)  
  fig.add_trace(trace3,secondary_y=True)  
  fig.add_trace(trace4,secondary_y=True)  
  fig.update_layout(xaxis=dict(tickmode='linear', tick0=0, dtick=2, tickangle=0,  
                               title = 'Week of the year'),  
      height = 600, width = 800, title = 'Summary of annual customer activity over the weeks')  
  fig.update_layout(legend=dict(yanchor=&quot;top&quot;, y=0.99, xanchor=&quot;left&quot;, x=0.01), showlegend=True)  
  fig.update_layout(legend_title_text='Legend')  
  fig['layout']['yaxis'].update(title='Spend sum / bought items',  
                                range=[0, 1000000], dtick=200000, autorange=False)  
  fig['layout']['yaxis2'].update(title='No. of clients / invoices',  
                                range=[0, 2000], dtick=400, autorange=False)  
  fig.show()
  
  
  </code></pre>