Skip to content

Commit 87501d8

Browse files
committed
force set axis.position when anchor == 'free'
1 parent 8dc3f80 commit 87501d8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

plotly/tools.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ def _add_domain(layout, x_or_y, label, domain, anchor, position):
872872
axis = getattr(graph_objs, graph_obj)(domain=domain)
873873
if anchor:
874874
axis['anchor'] = anchor
875-
if position: # N.B. No need to add position == 0 to axis
875+
if isinstance(position, float):
876876
axis['position'] = position
877877
layout[name] = axis
878878

@@ -935,14 +935,20 @@ def _add_domain_is_3d(layout, s_label, x_domain, y_domain):
935935

936936
# Add a xaxis to layout (N.B anchor == False -> no axis)
937937
if x_anchor:
938-
x_position = y_domain[0] if x_anchor == 'free' else 0
938+
if x_anchor == 'free':
939+
x_position = y_domain[0]
940+
else:
941+
x_position = False
939942
_add_domain(layout, 'x', x_label, x_domain,
940943
x_anchor, x_position)
941944
x_cnt += 1
942945

943946
# Add a yaxis to layout (N.B anchor == False -> no axis)
944947
if y_anchor:
945-
y_position = x_domain[0] if y_anchor == 'free' else 0
948+
if y_anchor == 'free':
949+
y_position = x_domain[0]
950+
else:
951+
y_position = False
946952
_add_domain(layout, 'y', y_label, y_domain,
947953
y_anchor, y_position)
948954
y_cnt += 1

0 commit comments

Comments
 (0)