Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Default showlegend changed with update

The showlegend behaviour appears to have changed recently

I use to specify showlegend: true, and it would add a new legend for every plot added

I’ve made a quick demo file to show what I mean


<link rel="stylesheet" href="">

<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 

<script type="text/javascript" src="js/d3.min.js"></script>

<script src=""></script>
<meta charset="UTF-8" />



function makePlotly( x, y ,legendname ){

var plotDiv = document.getElementById("myDiv");
var traces = [{
x: x, 
y: y,
name: legendname
var layout = {
//showlegend: false, //always shows nothing
//showlegend: true, // only shows one legend at a time
//no legend setting works best for line but only shows a max of two legends
autosize: true,
width: 1000,
height: 1000,
xaxis: {
title: 'x'
yaxis: {
title: 'y'             
font: {
family: "Open Sans, sans-serif", 
size: 19

Plotly.plot('myDiv', traces,layout,{displayModeBar: true},{showLink: false});
//Plotly.newPlot('myDiv', traces,layout,{displayModeBar: true},{showLink: false});

<button onclick="makePlotly([1,2,3],[2,3,4],'plot 1')">plot data</button>

<button onclick="makePlotly([2,3.2,5],[2,3,4],'plot 2')">plot data</button>

<button onclick="makePlotly([6],[3],'plot 3')">plot data scatter</button>

<button onclick="makePlotly([6.5],[2],'plot 4')">plot data scatter</button>

<div align="center">
<div align="center" id="myDiv" style="width: 100%; height: 100%;"><!-- Plotly chart will be drawn inside this DIV --></div>



Here is an example of how the legend only shows two plots even when more than two are included

I’m finding that

showlegend: false, //always shows nothing

showlegend: true, // only shows one legend at a time

no legend setting works shows a max of two legends

Any tips as this use to work about a week ago

I have reproduced the old plotly 1.6.3 and this works fine.

every new trace adds a new legend

here is an example



This issue will be in the next plotly.js release. See for more info.