santosjorge / cufflinks

Productivity Tools for Plotly + Pandas
MIT License
3.02k stars 675 forks source link

Unable to group or remove legend for multiple cf.subplots #258

Open wyczolko opened 3 years ago

wyczolko commented 3 years ago

I have a group of subplots all of the form:

fig5 = px.scatter(dashOut['BO'], x=dashOut['BO'].index, y='BO', color='Sign', color_discrete_map={ -1: "red", 1: "blue", },size='Mag',hover_data=['P_chg','VLM_chg','OI_chg']) fig5.update(layout_coloraxis_showscale=False) fig5.add_trace(go.Scatter(x=dashOut['BO'].index, y=dashOut['BO']['BO'], mode='lines', name='lines',showlegend=False))

And a combination thereof with cf.subplots: py.plot(cf.subplots([fig,fig1,fig2,fig3,fig4,fig5],shape=(3,2),subplot_titles=("Corn OI/VOLUME/PRICE ACTION","Chi Wheat OI/VOLUME/PRICE ACTION","KC OI/VOLUME/PRICE ACTION", \ "Soybeans OI/VOLUME/PRICE ACTION","Soymeal OI/VOLUME/PRICE ACTION","Beanoil OI/VOLUME/PRICE ACTION")),filename='tst3.html')

The charts are perfect as expected except I have 6 legend entries for each color. How do I group the entries so my legend will not replicate x the amount of charts in the subplot grouping...or at the very least how can I turn off the legend altogether. No traditional plotly configuration methods such as show_legend = False on update fig calls have worked.

Capture