@@ -352,12 +352,18 @@ def configure_cartesian_marginal_axes(args, fig, orders):
352
352
353
353
# Add axis titles to non-marginal subplots
354
354
y_title = get_decorated_label (args , args ["y" ], "y" )
355
- for row in range (1 , nrows ):
356
- fig .update_yaxes (title_text = y_title , row = row , col = 1 )
355
+ if args ["marginal_x" ]:
356
+ fig .update_yaxes (title_text = y_title , row = 1 , col = 1 )
357
+ else :
358
+ for row in range (1 , nrows + 1 ):
359
+ fig .update_yaxes (title_text = y_title , row = row , col = 1 )
357
360
358
361
x_title = get_decorated_label (args , args ["x" ], "x" )
359
- for col in range (1 , ncols ):
360
- fig .update_xaxes (title_text = x_title , row = 1 , col = col )
362
+ if args ["marginal_y" ]:
363
+ fig .update_xaxes (title_text = x_title , row = 1 , col = 1 )
364
+ else :
365
+ for col in range (1 , ncols + 1 ):
366
+ fig .update_xaxes (title_text = x_title , row = 1 , col = col )
361
367
362
368
# Configure axis type across all x-axes
363
369
if "log_x" in args and args ["log_x" ]:
@@ -393,8 +399,7 @@ def configure_cartesian_axes(args, fig, orders):
393
399
394
400
# Set x-axis titles and axis options in the bottom-most row
395
401
x_title = get_decorated_label (args , args ["x" ], "x" )
396
- nrows = len (fig ._grid_ref )
397
- for xaxis in fig .select_xaxes (row = nrows ):
402
+ for xaxis in fig .select_xaxes (row = 1 ):
398
403
xaxis .update (title_text = x_title )
399
404
set_cartesian_axis_opts (args , xaxis , "x" , orders )
400
405
@@ -959,7 +964,7 @@ def make_figure(args, constructor, trace_patch={}, layout_patch={}):
959
964
row = m .val_map [val ]
960
965
trace ._subplot_row_val = val
961
966
else :
962
- if trace_spec .marginal = = "x" :
967
+ if has_marginal_x and trace_spec .marginal ! = "x" :
963
968
row = 2
964
969
else :
965
970
row = 1
@@ -1040,7 +1045,11 @@ def make_figure(args, constructor, trace_patch={}, layout_patch={}):
1040
1045
continue
1041
1046
1042
1047
_set_trace_grid_reference (
1043
- trace , fig .layout , fig ._grid_ref , trace ._subplot_row , trace ._subplot_col
1048
+ trace ,
1049
+ fig .layout ,
1050
+ fig ._grid_ref ,
1051
+ nrows - trace ._subplot_row + 1 ,
1052
+ trace ._subplot_col ,
1044
1053
)
1045
1054
1046
1055
# Add traces, layout and frames to figure
@@ -1123,13 +1132,13 @@ def init_figure(
1123
1132
specs = specs ,
1124
1133
shared_xaxes = "all" ,
1125
1134
shared_yaxes = "all" ,
1126
- row_titles = row_titles ,
1135
+ row_titles = list ( reversed ( row_titles )) ,
1127
1136
column_titles = column_titles ,
1128
1137
horizontal_spacing = horizontal_spacing ,
1129
1138
vertical_spacing = vertical_spacing ,
1130
1139
row_heights = row_heights ,
1131
1140
column_widths = column_widths ,
1132
- start_cell = "top -left" ,
1141
+ start_cell = "bottom -left" ,
1133
1142
)
1134
1143
1135
1144
# Remove explicit font size of row/col titles so template can take over
0 commit comments