✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Subplot overlaps while using subplots and dropdown menus together

I am currently implementing subplots under different tabs using dropdown buttons(update menus)

I’m able to successfully provide different axis labels for each tab without using subplots.

In the case of subplots - When i try to provide different axes titles for each dropdown option, there’s an overlap between the subplots. There is no overlap between the subplots if i remove the axes parameters.


selected_cols=['Actual vs Predicted','Residual vs Predicted Plot','Residual Histogram']
for each_col in selected_cols:
    if each_col == 'Actual vs Predicted':
        vis_check_flat = [True,True,False,False,False]
    elif each_col == 'Residual vs Predicted Plot':
        vis_check_flat = [False,False,True,True,False]
    else:
        vis_check_flat = [False,False,False,False,True]
    if each_col == 'Actual vs Predicted':
        tab_dict_list.append(dict(args = [{"visible": vis_check_flat},
                                      {"title": "{}".format(each_col)
                                       #"xaxis": {"title":"Predicted"},
                                       #"yaxis": {"title":"Actual"},
                                       }],
                              label=each_col, method="update"))
    elif each_col == 'Residual vs Predicted Plot':
        tab_dict_list.append(dict(args = [{"visible": vis_check_flat},
                                      {"title": "{}".format(each_col),
                                       #"xaxis": {"title":"Predicted"},
                                       #"yaxis1": {"title":"Residual"}}],
                              label=each_col, method="update"))
    else:
        tab_dict_list.append(dict(args = [{"visible": vis_check_flat},
                                      {"title": "{}".format(each_col),
                                       #"xaxis": {"title":"Residuals"},
                                       #"yaxis": {"title":"Count"} }],
                              label=each_col, method="update"))
    fig.update_layout(updatemenus=[dict(buttons=list(tab_dict_list),
                                    direction="right", x=0, xanchor="left", y=1.11, yanchor="top")],
                  showlegend=True, title_x=0.5)



Without axis titles:

With axis titles: