Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions plotly/_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def make_subplots(
row_titles=None,
x_title=None,
y_title=None,
font=dict(size=16),
figure=None,
**kwargs,
):
Expand Down Expand Up @@ -227,6 +228,9 @@ def make_subplots(
Title to place to the left of the left column of subplots,
centered vertically

font: dict (default dict(size=16))
Font used by any title of the subplots.

figure: go.Figure or None (default None)
If None, a new go.Figure instance will be created and its axes will be
populated with those corresponding to the requested subplot geometry and
Expand Down Expand Up @@ -814,7 +818,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):

# Add subplot titles
plot_title_annotations = _build_subplot_title_annotations(
subplot_titles, list_of_domains
subplot_titles, list_of_domains, font = font
)

layout["annotations"] = plot_title_annotations
Expand All @@ -835,7 +839,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):

# Add subplot titles
column_title_annotations = _build_subplot_title_annotations(
column_titles, domains_list
column_titles, domains_list, font = font
)

layout["annotations"] += tuple(column_title_annotations)
Expand All @@ -849,7 +853,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):

# Add subplot titles
column_title_annotations = _build_subplot_title_annotations(
row_titles, domains_list, title_edge="right"
row_titles, domains_list, title_edge="right", font = font
)

layout["annotations"] += tuple(column_title_annotations)
Expand All @@ -859,7 +863,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):

# Add subplot titles
column_title_annotations = _build_subplot_title_annotations(
[x_title], domains_list, title_edge="bottom", offset=30
[x_title], domains_list, title_edge="bottom", offset=30, font = font
)

layout["annotations"] += tuple(column_title_annotations)
Expand All @@ -869,7 +873,7 @@ def _check_hv_spacing(dimsize, spacing, name, dimvarname, dimname):

# Add subplot titles
column_title_annotations = _build_subplot_title_annotations(
[y_title], domains_list, title_edge="left", offset=40
[y_title], domains_list, title_edge="left", offset=40, font = font
)

layout["annotations"] += tuple(column_title_annotations)
Expand Down Expand Up @@ -1163,7 +1167,7 @@ def _get_cartesian_label(x_or_y, r, c, cnt):


def _build_subplot_title_annotations(
subplot_titles, list_of_domains, title_edge="top", offset=0
subplot_titles, list_of_domains, title_edge="top", offset=0, font=dict(size=16)
):
# If shared_axes is False (default) use list_of_domains
# This is used for insets and irregular layouts
Expand Down Expand Up @@ -1236,7 +1240,7 @@ def _build_subplot_title_annotations(
"yref": "paper",
"text": subplot_titles[index],
"showarrow": False,
"font": dict(size=16),
"font": font,
"xanchor": xanchor,
"yanchor": yanchor,
}
Expand Down