Trying to get Legend Titles to work

I’m trying to get legend titles to work. I’ve upgraded to Dash 1.9 and Plotly 4.5.

I have this in my callback:

...
fig['layout']['legend'] = dict(
                title=dict(text="Alert Level"),
                x=-0.02,
                y=0.8
            )
...

The legend positioning works fine. The title isn’t rendering. What am I missing?

Hi @millercommamatt, this is weird indeed. Could you please try a few things:

  • try the example from https://plot.ly/python/legend/#legend-titles in a Jupyter notebook (or a browser renderer) to check that the figure looks like the one of the doc
  • try title="Alert level" (the syntax you’ve used should work I guess, but for the sake of debugging…)
  • check the web console to check whether there are error messages in Javascript

After some restarting of software, I now have the legend title showing. Something must have still been holding onto my pre-upgrade environment.