Hi, I think I still donβt understand what you are after. You get two categories because you have two categories, namely A and B.
Maybe you could your data (or equivalent data) ? In general, the legend in plotly is somehow limited IMHO. A possible solution could be the use of graph_objects and legendgroups