from plotly.subplots import make_subplots import plotly.graph_objects as go nrows = 4 ncols = 3 plot_array = np.arange(0, nrows*ncols).reshape(nrows, ncols) subplot_titles = [f'{row.Index.split("_")[0]}: {row.similarity_score:.2f}' for row in spearman_rank_corr.itertuples()] fig = make_subplots(rows=nrows, cols=ncols, subplot_titles=subplot_titles) for index, score in enumerate(spearman_rank_corr.index): row, col = np.argwhere(plot_array == index)[0] fig.add_trace( go.Scatter( x=stsb_test[score_cols[0]], y=stsb_test[score], mode='markers', ), row=row+1, col=col+1 ) fig.update_layout(height=700, width=1000, title_text='Spearman Rank Correlation (ρ × 100)', showlegend=False) fig.show()