Jellyfish042 commited on
Commit
4cb7819
·
1 Parent(s): b14bc55
Files changed (1) hide show
  1. app.py +51 -20
app.py CHANGED
@@ -1067,11 +1067,38 @@ def create_category_scaling_plot(
1067
  hovertemplate=build_fit_line_hovertemplate(fit_label, a, b, c, raw_rmse, log_rmse),
1068
  )
1069
  )
1070
- else:
1071
- # 单独显示模式:为每个数据集创建散点图和拟合线
1072
- for idx, dataset in enumerate(selected_datasets):
1073
- if dataset not in new_df.columns:
1074
- continue
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1075
 
1076
  # 提取该数据集的数据
1077
  x_values = new_df["Params (B)"].astype(float).tolist()
@@ -1138,8 +1165,9 @@ def create_category_scaling_plot(
1138
  + "<extra></extra>"
1139
  ),
1140
  legendgroup=dataset,
1141
- )
1142
- )
 
1143
 
1144
  # 如果使用帕累托前沿,高亮显示帕累托前沿的点
1145
  if use_pareto:
@@ -1168,9 +1196,10 @@ def create_category_scaling_plot(
1168
  + "<extra></extra>"
1169
  ),
1170
  legendgroup=dataset,
1171
- )
1172
- )
1173
-
 
1174
  # 添加拟合曲线
1175
  fit_type = "Pareto Fit" if use_pareto else "Fit"
1176
  fit_label = f"{dataset} ({fit_type})"
@@ -1179,7 +1208,7 @@ def create_category_scaling_plot(
1179
  x=fit_x.tolist(),
1180
  y=fit_y.tolist(),
1181
  mode="lines",
1182
- name=fit_label,
1183
  line=dict(color=color, width=2, dash="dash"),
1184
  hovertemplate=build_fit_line_hovertemplate(fit_label, a, b, c, raw_rmse, log_rmse),
1185
  legendgroup=dataset,
@@ -1208,13 +1237,13 @@ def create_category_scaling_plot(
1208
  coloraxis = create_fit_delta_coloraxis(all_delta_values)
1209
  coloraxis["colorbar"].update(
1210
  dict(
1211
- x=1.01,
1212
  xanchor="left",
1213
  y=0.5,
1214
  yanchor="middle",
1215
- len=0.86,
1216
- thickness=42,
1217
- tickfont=dict(size=10),
1218
  title=dict(text="vs fit", side="top"),
1219
  )
1220
  )
@@ -1226,12 +1255,14 @@ def create_category_scaling_plot(
1226
  showlegend=True,
1227
  legend=dict(
1228
  yanchor="top",
1229
- y=0.99,
1230
  xanchor="left",
1231
- x=1.18,
1232
- bgcolor="rgba(255,255,255,0.9)",
 
 
1233
  font=dict(size=9),
1234
- tracegroupgap=6,
1235
  ),
1236
  xaxis=dict(
1237
  title="Parameters (B)",
@@ -1253,7 +1284,7 @@ def create_category_scaling_plot(
1253
  autorange="reversed",
1254
  ),
1255
  coloraxis=coloraxis,
1256
- margin=dict(l=70, r=320, t=70, b=65), # 为图例和颜色条预留空间
1257
  )
1258
  return fig
1259
 
 
1067
  hovertemplate=build_fit_line_hovertemplate(fit_label, a, b, c, raw_rmse, log_rmse),
1068
  )
1069
  )
1070
+ else:
1071
+ # 单独显示模式:为每个数据集创建散点图和拟合线
1072
+ fig.add_trace(
1073
+ go.Scatter(
1074
+ x=[None],
1075
+ y=[None],
1076
+ mode="markers",
1077
+ name="Non-Pareto",
1078
+ marker=dict(size=9, color="rgba(55,65,81,0.9)", symbol="circle"),
1079
+ hoverinfo="skip",
1080
+ )
1081
+ )
1082
+ if use_pareto:
1083
+ fig.add_trace(
1084
+ go.Scatter(
1085
+ x=[None],
1086
+ y=[None],
1087
+ mode="markers",
1088
+ name="Pareto",
1089
+ marker=dict(
1090
+ size=10,
1091
+ color="rgba(255,255,255,0.95)",
1092
+ symbol="diamond",
1093
+ line=dict(color="#263238", width=1.1),
1094
+ ),
1095
+ hoverinfo="skip",
1096
+ )
1097
+ )
1098
+
1099
+ for idx, dataset in enumerate(selected_datasets):
1100
+ if dataset not in new_df.columns:
1101
+ continue
1102
 
1103
  # 提取该数据集的数据
1104
  x_values = new_df["Params (B)"].astype(float).tolist()
 
1165
  + "<extra></extra>"
1166
  ),
1167
  legendgroup=dataset,
1168
+ showlegend=False,
1169
+ )
1170
+ )
1171
 
1172
  # 如果使用帕累托前沿,高亮显示帕累托前沿的点
1173
  if use_pareto:
 
1196
  + "<extra></extra>"
1197
  ),
1198
  legendgroup=dataset,
1199
+ showlegend=False,
1200
+ )
1201
+ )
1202
+
1203
  # 添加拟合曲线
1204
  fit_type = "Pareto Fit" if use_pareto else "Fit"
1205
  fit_label = f"{dataset} ({fit_type})"
 
1208
  x=fit_x.tolist(),
1209
  y=fit_y.tolist(),
1210
  mode="lines",
1211
+ name=dataset,
1212
  line=dict(color=color, width=2, dash="dash"),
1213
  hovertemplate=build_fit_line_hovertemplate(fit_label, a, b, c, raw_rmse, log_rmse),
1214
  legendgroup=dataset,
 
1237
  coloraxis = create_fit_delta_coloraxis(all_delta_values)
1238
  coloraxis["colorbar"].update(
1239
  dict(
1240
+ x=1.02,
1241
  xanchor="left",
1242
  y=0.5,
1243
  yanchor="middle",
1244
+ len=0.72,
1245
+ thickness=28,
1246
+ tickfont=dict(size=9),
1247
  title=dict(text="vs fit", side="top"),
1248
  )
1249
  )
 
1255
  showlegend=True,
1256
  legend=dict(
1257
  yanchor="top",
1258
+ y=0.98,
1259
  xanchor="left",
1260
+ x=0.02,
1261
+ bgcolor="rgba(255,255,255,0.78)",
1262
+ bordercolor="rgba(15,23,42,0.08)",
1263
+ borderwidth=1,
1264
  font=dict(size=9),
1265
+ tracegroupgap=2,
1266
  ),
1267
  xaxis=dict(
1268
  title="Parameters (B)",
 
1284
  autorange="reversed",
1285
  ),
1286
  coloraxis=coloraxis,
1287
+ margin=dict(l=70, r=80, t=70, b=65),
1288
  )
1289
  return fig
1290