Black Lives Matter. Please consider donating to Black Girls Code today.

Plotting legend help

Question regarding plotting in a notebook or pycharm.

Currently when plotting names have to be assigned to have the legend state the value being plotted or else you just a trace 1 or trace 2 name.

Such as trace3 = go.Scatter(
x = Weeks,
y = Courier_CTD,
name = ‘Kansas’,
line = dict(
color = (‘rgb(8,48,107)’),
width = 4,
dash = ‘dash’),

If I want that name to be whatever the name or value is in the region column is that possible?

Hi @ssharma87,

I don’t think I understand your question. Could you explain what you mean by “whatever the name or value is in the region column”?

Also, it would helpful if you could include a small complete example of your starting point. Something with the imports and simple variable definitions (e.g. an example of what Weeks and Courier_CTD are), formatted in a fenced code block.