Skip to content

Commit 6bb76e6

Browse files
Change for backwards compatability
Removed the match keyword, as that was introduced in python 3.10, making it incompatible with previous python versions
1 parent b5d58f5 commit 6bb76e6

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

plotly/_subplots.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -924,8 +924,8 @@ def _configure_shared_axes(
924924
row_count : int = len(grid_ref)
925925
column_count : int = len(grid_ref[0])
926926

927-
BASE_TRACE_LAYER = 0
928-
SECOND_Y_LAYER = 1
927+
BASE_TRACE_LAYER = 0 # Layer for subplots
928+
SECOND_Y_LAYER = 1 # Layer for the second y-axis on the right hand side
929929

930930
axis_index : int = 0 if x_or_y == 'x' else 1
931931

@@ -1077,18 +1077,17 @@ def all_mode(rows : Tuple[int], columns : Tuple[int], trace_layer : int):
10771077
rows : Tuple[int] = tuple(range(row_count - 1, -1, -1)) if row_direction < 0 else tuple(range(row_count))
10781078
columns : Tuple[int] = tuple(range(column_count))
10791079

1080-
match(shared, x_or_y):
1081-
case ('columns', _) | (True, 'x'): # If columns mode, or shared and x
1082-
columns_mode(rows, columns, BASE_TRACE_LAYER)
1083-
columns_mode(tuple(reversed(rows)), columns, SECOND_Y_LAYER)
1084-
case ('rows', _) | (True, 'y'): # If rows mode, or shared and y
1085-
rows_mode(rows, columns, BASE_TRACE_LAYER)
1086-
rows_mode(rows, tuple(reversed(columns)), SECOND_Y_LAYER)
1087-
case ('all', _): # If all mode
1088-
all_mode(rows, columns, BASE_TRACE_LAYER)
1089-
all_mode(tuple(reversed(rows)), tuple(reversed(columns)), SECOND_Y_LAYER)
1090-
case _: # If reached the other case
1091-
return
1080+
if shared == 'columns' or (x_or_y == 'x' and shared == True):
1081+
columns_mode(rows, columns, BASE_TRACE_LAYER)
1082+
columns_mode(tuple(reversed(rows)), columns, SECOND_Y_LAYER)
1083+
elif shared == 'rows' or (x_or_y == 'y' and shared == True):
1084+
rows_mode(rows, columns, BASE_TRACE_LAYER)
1085+
rows_mode(rows, tuple(reversed(columns)), SECOND_Y_LAYER)
1086+
elif shared == 'all':
1087+
all_mode(rows, columns, BASE_TRACE_LAYER)
1088+
all_mode(tuple(reversed(rows)), tuple(reversed(columns)), SECOND_Y_LAYER)
1089+
else:
1090+
return
10921091

10931092
def _init_subplot_xy(layout, secondary_y, x_domain, y_domain, max_subplot_ids=None):
10941093
if max_subplot_ids is None:

0 commit comments

Comments
 (0)