Answers for "plotly express change legend labels"

0

plotly express change legend labels

newnames = {'col1':'hello', 'col2': 'hi'}
fig.for_each_trace(lambda t: t.update(name = newnames[t.name],
                                      legendgroup = newnames[t.name],
                                      hovertemplate = t.hovertemplate.replace(t.name, newnames[t.name])
                                     )
                  )
Posted by: Guest on March-19-2022

Python Answers by Framework

Browse Popular Code Answers by Language