✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Why legend-title is not working?

I try to add the legend title and it’s not working for me. Anyone please help me. This is an example

Could you try setting title text via title.text?
Something like:

var layout = {
  title: { text: 'Line and Scatter Plot' },
  legend: {
    title: { text: 'legend title' },
    ...
  }
}

I had the same issue but realized the issue only occurred with an ipython kernel (jupyter notebook or hydrogen). The issue is alleviated by running the script in the terminal.