@@ -586,6 +586,31 @@ def make_subplots(rows=1, cols=1,
586
586
fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2])]
587
587
fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
588
588
589
+ Example 5:
590
+ # include subplot titles
591
+ fig = tools.make_subplots(rows=2, subplot_titles=('Plot 1','Plot 2'))
592
+
593
+ This is the format of your plot grid:
594
+ [ (1,1) x1,y1 ]
595
+ [ (2,1) x2,y2 ]
596
+
597
+ fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2])]
598
+ fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
599
+
600
+ Example 6:
601
+ # Include subplot title on one plot (but not all)
602
+ fig = tools.make_subplots(insets=[{'cell': (1,1), 'l': 0.7, 'b': 0.3}],
603
+ subplot_titles=('','Inset'))
604
+
605
+ This is the format of your plot grid!
606
+ [ (1,1) x1,y1 ]
607
+
608
+ With insets:
609
+ [ x2,y2 ] over [ (1,1) x1,y1 ]
610
+
611
+ fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2])]
612
+ fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
613
+
589
614
Keywords arguments with constant defaults:
590
615
591
616
rows (kwarg, int greater than 0, default=1):
@@ -632,6 +657,8 @@ def make_subplots(rows=1, cols=1,
632
657
633
658
subplot_titles (kwarg, list of strings, default=empty list):
634
659
Title of each subplot.
660
+ "" can be included in the list if no subplot title is desired in
661
+ that space so that the titles are properly indexed.
635
662
636
663
specs (kwarg, list of lists of dictionaries):
637
664
Subplot specifications.
@@ -1143,23 +1170,23 @@ def _pad(s, cell_len=cell_len):
1143
1170
)
1144
1171
1145
1172
# Add subplot 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 ]
1173
+ x_dom = list_of_domains [::2 ]
1174
+ y_dom = list_of_domains [1 ::2 ]
1151
1175
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 ])
1176
+ subtitle_pos_x = []
1177
+ for index in range (len (x_dom )):
1178
+ subtitle_pos_x .append (((x_dom [index ][1 ])- (x_dom [index ][0 ]))/ 2 +
1179
+ x_dom [index ][0 ])
1156
1180
1157
- subtitle_pos_y = []
1158
- for index in range (len (y_dom )):
1159
- subtitle_pos_y .append (y_dom [index ][1 ])
1181
+ subtitle_pos_y = []
1182
+ for index in range (len (y_dom )):
1183
+ subtitle_pos_y .append (y_dom [index ][1 ])
1160
1184
1161
- plot_titles = []
1162
- for index in range (len (x_dom )):
1185
+ plot_titles = []
1186
+ for index in range (len (subplot_titles )):
1187
+ if not subplot_titles [index ]:
1188
+ pass
1189
+ else :
1163
1190
plot_titles .append ({'y' : subtitle_pos_y [index ],
1164
1191
'xref' : 'paper' ,
1165
1192
'x' : subtitle_pos_x [index ],
0 commit comments