Skip to content

Commit 2de9ad7

Browse files
committed
update get_anchors logic:
- shared_xaxes=True -> shared x axis at bottom, always
1 parent e4d4936 commit 2de9ad7

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

plotly/tools.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,9 @@ def _get_label(x_or_y, r, c, cnt, shared_axes):
819819

820820
return label
821821

822+
# Row in grid of anchor row if shared_xaxes=True
823+
ANCHOR_ROW = 0 if ROW_DIR > 0 else rows - 1
824+
822825
# Function handling logic around 2d axis anchors
823826
# Return 'x{}' | 'y{}' | 'free' | False
824827
def _get_anchors(r, c, x_cnt, y_cnt, shared_xaxes, shared_yaxes):
@@ -828,12 +831,10 @@ def _get_anchors(r, c, x_cnt, y_cnt, shared_xaxes, shared_yaxes):
828831

829832
if isinstance(shared_xaxes, bool):
830833
if shared_xaxes:
831-
if r == 0:
832-
x_anchor = "y{col_cnt}".format(col_cnt=c+1)
833-
else:
834+
if r != ANCHOR_ROW:
834835
x_anchor = False
835836
y_anchor = 'free'
836-
if shared_yaxes and c > 0: # TODO covers all cases?
837+
if shared_yaxes and c != 0: # TODO covers all cases?
837838
y_anchor = False
838839
return x_anchor, y_anchor
839840

@@ -847,12 +848,10 @@ def _get_anchors(r, c, x_cnt, y_cnt, shared_xaxes, shared_yaxes):
847848

848849
if isinstance(shared_yaxes, bool):
849850
if shared_yaxes:
850-
if c == 0:
851-
y_anchor = "x{row_cnt}".format(row_cnt=r+1)
852-
else:
851+
if c != 0:
853852
y_anchor = False
854853
x_anchor = 'free'
855-
if shared_xaxes and r > 0: # TODO covers all cases?
854+
if shared_xaxes and r != ANCHOR_ROW: # TODO all cases?
856855
x_anchor = False
857856
return x_anchor, y_anchor
858857

0 commit comments

Comments
 (0)