Skip to content

Commit 19ec4b6

Browse files
committed
remove empty string labels
1 parent 90607b5 commit 19ec4b6

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

plotly/tools.py

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ def make_subplots(rows=1, cols=1,
741741
try:
742742
subplot_titles = kwargs['subplot_titles']
743743
except KeyError:
744-
subplot_titles = [""]*rows*cols
744+
subplot_titles = []
745745

746746
# Sanitize 'specs' (must be a list of lists)
747747
exception_msg = "Keyword argument 'specs' must be a list of lists"
@@ -1143,32 +1143,35 @@ def _pad(s, cell_len=cell_len):
11431143
)
11441144

11451145
# Add subplot titles
1146-
x_dom = list_of_domains[::2]
1147-
y_dom = list_of_domains[1::2]
1148-
1149-
subtitle_pos_x = []
1150-
for index in range(len(x_dom)):
1151-
subtitle_pos_x.append(((x_dom[index][1])-(x_dom[index][0]))/2 +
1152-
x_dom[index][0])
1153-
1154-
subtitle_pos_y = []
1155-
for index in range(len(y_dom)):
1156-
subtitle_pos_y.append(y_dom[index][1])
1157-
1158-
plot_titles = []
1159-
for index in range(len(x_dom)):
1160-
plot_titles.append({'y': subtitle_pos_y[index],
1161-
'xref': 'paper',
1162-
'x': subtitle_pos_x[index],
1163-
'yref': 'paper',
1164-
'text': subplot_titles[index],
1165-
'showarrow': False,
1166-
'font': Font(size=18),
1167-
'xanchor': 'center',
1168-
'yanchor': 'bottom'
1169-
})
1170-
1171-
layout['annotations'] = plot_titles
1146+
if not subplot_titles:
1147+
pass
1148+
else:
1149+
x_dom = list_of_domains[::2]
1150+
y_dom = list_of_domains[1::2]
1151+
1152+
subtitle_pos_x = []
1153+
for index in range(len(x_dom)):
1154+
subtitle_pos_x.append(((x_dom[index][1])-(x_dom[index][0]))/2 +
1155+
x_dom[index][0])
1156+
1157+
subtitle_pos_y = []
1158+
for index in range(len(y_dom)):
1159+
subtitle_pos_y.append(y_dom[index][1])
1160+
1161+
plot_titles = []
1162+
for index in range(len(x_dom)):
1163+
plot_titles.append({'y': subtitle_pos_y[index],
1164+
'xref': 'paper',
1165+
'x': subtitle_pos_x[index],
1166+
'yref': 'paper',
1167+
'text': subplot_titles[index],
1168+
'showarrow': False,
1169+
'font': Font(size=18),
1170+
'xanchor': 'center',
1171+
'yanchor': 'bottom'
1172+
})
1173+
1174+
layout['annotations'] = plot_titles
11721175

11731176
if print_grid:
11741177
print(grid_str)

0 commit comments

Comments
 (0)