@@ -2006,7 +2006,14 @@ def _validate_rows_cols(name, n, vals):
2006
2006
BaseFigure ._raise_invalid_rows_cols (name = name , n = n , invalid = vals )
2007
2007
2008
2008
def add_trace (
2009
- self , trace , row = None , col = None , secondary_y = None , exclude_empty_subplots = False
2009
+ self ,
2010
+ trace ,
2011
+ row = None ,
2012
+ col = None ,
2013
+ secondary_y = None ,
2014
+ exclude_empty_subplots = False ,
2015
+ xaxis_title = None ,
2016
+ yaxis_title = None ,
2010
2017
):
2011
2018
"""
2012
2019
Add a trace to the figure
@@ -2050,6 +2057,12 @@ def add_trace(
2050
2057
exclude_empty_subplots: boolean
2051
2058
If True, the trace will not be added to subplots that don't already
2052
2059
have traces.
2060
+ x_axis_title: str or None (default None)
2061
+ The title of the x-axis for the subplot at the specified row and
2062
+ col.
2063
+ y_axis_title: str or None (default None)
2064
+ The title of the y-axis for the subplot at the specified row and
2065
+ col.
2053
2066
Returns
2054
2067
-------
2055
2068
BaseFigure
@@ -2101,17 +2114,27 @@ def add_trace(
2101
2114
col = c ,
2102
2115
secondary_y = secondary_y ,
2103
2116
exclude_empty_subplots = exclude_empty_subplots ,
2117
+ xaxis_title = xaxis_title ,
2118
+ yaxis_title = yaxis_title ,
2104
2119
)
2105
2120
return self
2106
-
2107
- return self .add_traces (
2121
+
2122
+ result = self .add_traces (
2108
2123
data = [trace ],
2109
2124
rows = [row ] if row is not None else None ,
2110
2125
cols = [col ] if col is not None else None ,
2111
2126
secondary_ys = [secondary_y ] if secondary_y is not None else None ,
2112
2127
exclude_empty_subplots = exclude_empty_subplots ,
2113
2128
)
2114
2129
2130
+ if row is not None and col is not None :
2131
+ if xaxis_title is not None :
2132
+ self .update_xaxes (title_text = xaxis_title , row = row , col = col )
2133
+ if yaxis_title is not None :
2134
+ self .update_yaxes (title_text = yaxis_title , row = row , col = col )
2135
+
2136
+ return result
2137
+
2115
2138
def add_traces (
2116
2139
self ,
2117
2140
data ,
0 commit comments