Skip to content

Commit 73b3c7c

Browse files
committed
🐛 make orders and sorted_group_names backwards compatible
1 parent 6640d8f commit 73b3c7c

File tree

1 file changed

+9
-3
lines changed
  • packages/python/plotly/plotly/express

1 file changed

+9
-3
lines changed

Diff for: packages/python/plotly/plotly/express/_core.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -1916,10 +1916,17 @@ def get_orderings(args, grouper, grouped, all_same_group):
19161916
of a single dimension-group
19171917
"""
19181918
orders = {} if "category_orders" not in args else args["category_orders"].copy()
1919+
sorted_group_names = []
19191920

19201921
if all_same_group:
1921-
sorted_group_names = [("",) * len(grouper)]
1922-
return orders, sorted_group_names
1922+
for col in grouper:
1923+
if col != one_group:
1924+
single_val = args["data_frame"][col].iloc[0]
1925+
sorted_group_names.append(single_val)
1926+
orders[col] = [single_val]
1927+
else:
1928+
sorted_group_names.append("")
1929+
return orders, [tuple(sorted_group_names)]
19231930

19241931
for col in grouper:
19251932
if col != one_group:
@@ -1929,7 +1936,6 @@ def get_orderings(args, grouper, grouped, all_same_group):
19291936
else:
19301937
orders[col] = list(OrderedDict.fromkeys(list(orders[col]) + uniques))
19311938

1932-
sorted_group_names = []
19331939
for group_name in grouped.groups:
19341940
if len(grouper) == 1:
19351941
group_name = (group_name,)

0 commit comments

Comments
 (0)