@@ -58,6 +58,7 @@ def make_subplots(
5858 x_title = None ,
5959 y_title = None ,
6060 figure = None ,
61+ font = None ,
6162 ** kwargs ,
6263):
6364 """
@@ -235,6 +236,9 @@ def make_subplots(
235236 layout of this figure and this figure will be returned. If the figure
236237 already contains axes, they will be overwritten.
237238
239+ font: dict (default None)
240+ Font used by any title of the subplots.
241+
238242 Examples
239243 --------
240244
@@ -814,7 +818,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):
814818
815819 # Add subplot titles
816820 plot_title_annotations = _build_subplot_title_annotations (
817- subplot_titles , list_of_domains
821+ subplot_titles , list_of_domains , font = font
818822 )
819823
820824 layout ["annotations" ] = plot_title_annotations
@@ -835,7 +839,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):
835839
836840 # Add subplot titles
837841 column_title_annotations = _build_subplot_title_annotations (
838- column_titles , domains_list
842+ column_titles , domains_list , font = font
839843 )
840844
841845 layout ["annotations" ] += tuple (column_title_annotations )
@@ -849,7 +853,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):
849853
850854 # Add subplot titles
851855 column_title_annotations = _build_subplot_title_annotations (
852- row_titles , domains_list , title_edge = "right"
856+ row_titles , domains_list , title_edge = "right" , font = font
853857 )
854858
855859 layout ["annotations" ] += tuple (column_title_annotations )
@@ -859,7 +863,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):
859863
860864 # Add subplot titles
861865 column_title_annotations = _build_subplot_title_annotations (
862- [x_title ], domains_list , title_edge = "bottom" , offset = 30
866+ [x_title ], domains_list , title_edge = "bottom" , offset = 30 , font = font
863867 )
864868
865869 layout ["annotations" ] += tuple (column_title_annotations )
@@ -869,7 +873,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):
869873
870874 # Add subplot titles
871875 column_title_annotations = _build_subplot_title_annotations (
872- [y_title ], domains_list , title_edge = "left" , offset = 40
876+ [y_title ], domains_list , title_edge = "left" , offset = 40 , font = font
873877 )
874878
875879 layout ["annotations" ] += tuple (column_title_annotations )
@@ -1163,7 +1167,7 @@ def _get_cartesian_label(x_or_y, r, c, cnt):
11631167
11641168
11651169def _build_subplot_title_annotations (
1166- subplot_titles , list_of_domains , title_edge = "top" , offset = 0
1170+ subplot_titles , list_of_domains , title_edge = "top" , offset = 0 , font = None
11671171):
11681172 # If shared_axes is False (default) use list_of_domains
11691173 # This is used for insets and irregular layouts
@@ -1173,6 +1177,10 @@ def _build_subplot_title_annotations(
11731177 subtitle_pos_x = []
11741178 subtitle_pos_y = []
11751179
1180+ # If no font size is provided, use this fallback
1181+ if font is None :
1182+ font = dict (size = 16 )
1183+
11761184 if title_edge == "top" :
11771185 text_angle = 0
11781186 xanchor = "center"
@@ -1236,7 +1244,7 @@ def _build_subplot_title_annotations(
12361244 "yref" : "paper" ,
12371245 "text" : subplot_titles [index ],
12381246 "showarrow" : False ,
1239- "font" : dict ( size = 16 ) ,
1247+ "font" : font ,
12401248 "xanchor" : xanchor ,
12411249 "yanchor" : yanchor ,
12421250 }
0 commit comments