Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """Rename's legend in ploty express fig's, from stackoverflow post: https://stackoverflow.com/questions/72885525/plotly-cannot-manually-specify-labels-legend-entries-in-multiple-line-chart)"""
- new_names = {'example_1':'Example 1', 'example_2: 'Example 2'} # change to suit
- fig.for_each_trace(lambda t: t.update(name = newnames[t.name])) # change 'fig' to fig name
Advertisement
Add Comment
Please, Sign In to add comment