|
33 | 33 | df_melt = df_wbm.melt(
|
34 | 34 | id_vars=hover_cols,
|
35 | 35 | var_name=facet_col,
|
36 |
| - value_vars=df_metrics.T.MAE.nsmallest(6).index, |
| 36 | + # value_vars=df_metrics.T.MAE.nsmallest(6).index, # top 6 models by MAE |
| 37 | + value_vars=list(df_metrics), # all models |
37 | 38 | value_name=e_form_pred_col,
|
38 | 39 | )
|
39 | 40 |
|
|
112 | 113 | x=each_true_col,
|
113 | 114 | y=each_pred_col,
|
114 | 115 | facet_col=facet_col,
|
115 |
| - facet_col_wrap=2, |
| 116 | + facet_col_wrap=4, |
116 | 117 | facet_col_spacing=0.02,
|
117 | 118 | facet_row_spacing=0.04,
|
118 | 119 | hover_data=hover_cols,
|
119 | 120 | hover_name=df_wbm.index.name,
|
120 | 121 | color=clf_col,
|
121 | 122 | color_discrete_map=clf_color_map,
|
122 |
| - opacity=0.4, |
| 123 | + # opacity=0.4, |
123 | 124 | range_x=(-xy_max, xy_max),
|
124 | 125 | range_y=(-xy_max, xy_max),
|
125 | 126 | )
|
|
131 | 132 | # iterate over subplots and set new title
|
132 | 133 | for idx, anno in enumerate(fig.layout.annotations, 1):
|
133 | 134 | traces = [t for t in fig.data if t.xaxis == f"x{idx if idx > 1 else ''}"]
|
134 |
| - assert len(traces) == 4, f"Expected 4 traces, got {len(traces)=}" |
| 135 | + assert len(traces) in (0, 4), f"Plots be empty or have 4 traces, got {len(traces)=}" |
135 | 136 |
|
136 | 137 | model = anno.text.split("=", 1)[1]
|
137 | 138 | assert model in df_wbm, f"Unexpected {model=} not in {list(df_wbm)=}"
|
|
182 | 183 | fig.update_xaxes(nticks=5)
|
183 | 184 | fig.update_yaxes(nticks=5)
|
184 | 185 |
|
185 |
| -# remove legend title and place legend centered above subplots |
| 186 | +# remove legend title and place legend centered above subplots, increase marker size |
186 | 187 | fig.layout.legend.update(
|
187 |
| - title="", orientation="h", x=0.5, xanchor="center", y=1.1, yanchor="top" |
| 188 | + title="", orientation="h", x=0.5, xanchor="center", y=1.2, itemsizing="constant" |
188 | 189 | )
|
189 | 190 |
|
190 | 191 | # fig.update_layout(yaxis=dict(scaleanchor="x", scaleratio=1))
|
|
211 | 212 | # %%
|
212 | 213 | img_name = "each-scatter-models"
|
213 | 214 | save_fig(fig, f"{STATIC}/{img_name}.webp", scale=4, width=600, height=800)
|
214 |
| -save_fig(fig, f"{ROOT}/tmp/figures/{img_name}.pdf") |
| 215 | +save_fig(fig, f"{ROOT}/tmp/figures/{img_name}.pdf", width=1200) |
0 commit comments