openhands commited on
Commit
d64aeca
·
1 Parent(s): 261c66b

Fix logo zoom behavior in scatter plots

Browse files

Change images from domain to data coordinates so logos move with zoom.
Use xref='x' with log10 coordinates, yref='paper' for relative y positioning.

Files changed (1) hide show
  1. leaderboard_transformer.py +15 -15
leaderboard_transformer.py CHANGED
@@ -1268,37 +1268,37 @@ def _plot_scatter_plotly(
1268
  domain_x = max(0, min(1, domain_x))
1269
  domain_y = max(0, min(1, domain_y))
1270
 
 
 
 
 
1271
  if harness_uri is not None:
1272
- # Composite: stack model on top, harness on bottom, clamping
1273
- # each half to the plot area so markers near the edges don't
1274
- # drift off-canvas.
1275
- model_y = min(1, domain_y + STACKED_Y_OFFSET)
1276
- harness_y = max(0, domain_y - STACKED_Y_OFFSET)
1277
  layout_images.append(dict(
1278
  source=model_logo_uri,
1279
- xref="x domain", yref="y domain",
1280
- x=domain_x, y=model_y,
1281
  sizex=STACKED_SIZE_X, sizey=STACKED_SIZE_Y,
1282
  xanchor="center", yanchor="middle",
1283
  layer="above",
1284
  ))
1285
  layout_images.append(dict(
1286
  source=harness_uri,
1287
- xref="x domain", yref="y domain",
1288
- x=domain_x, y=harness_y,
1289
  sizex=STACKED_SIZE_X, sizey=STACKED_SIZE_Y,
1290
  xanchor="center", yanchor="middle",
1291
  layer="above",
1292
  ))
1293
  else:
1294
- # Single marker (canonical OpenHands pages, or Alternative Agents
1295
- # rows with an unknown harness name — the latter shouldn't happen
1296
- # in practice since HARNESS_LOGO_PATHS covers every agent_name the
1297
- # push-to-index script emits).
1298
  layout_images.append(dict(
1299
  source=model_logo_uri,
1300
- xref="x domain", yref="y domain",
1301
- x=domain_x, y=domain_y,
1302
  sizex=SINGLE_SIZE_X, sizey=SINGLE_SIZE_Y,
1303
  xanchor="center", yanchor="middle",
1304
  layer="above",
 
1268
  domain_x = max(0, min(1, domain_x))
1269
  domain_y = max(0, min(1, domain_y))
1270
 
1271
+ # Convert to data coordinates
1272
+ # For log scale x: use log10(x) to match the axis type
1273
+ x_log = np.log10(x_val) if x_val > 0 else x_min_log
1274
+
1275
  if harness_uri is not None:
1276
+ # Composite: stack model on top, harness on bottom
1277
+ # Use "paper" yref so offset stays relative when zooming
1278
+ model_y_domain = min(1, domain_y + STACKED_Y_OFFSET)
1279
+ harness_y_domain = max(0, domain_y - STACKED_Y_OFFSET)
 
1280
  layout_images.append(dict(
1281
  source=model_logo_uri,
1282
+ xref="x", yref="paper",
1283
+ x=x_log, y=model_y_domain,
1284
  sizex=STACKED_SIZE_X, sizey=STACKED_SIZE_Y,
1285
  xanchor="center", yanchor="middle",
1286
  layer="above",
1287
  ))
1288
  layout_images.append(dict(
1289
  source=harness_uri,
1290
+ xref="x", yref="paper",
1291
+ x=x_log, y=harness_y_domain,
1292
  sizex=STACKED_SIZE_X, sizey=STACKED_SIZE_Y,
1293
  xanchor="center", yanchor="middle",
1294
  layer="above",
1295
  ))
1296
  else:
1297
+ # Single marker - use "paper" yref so logo moves with x zoom but stays in relative y position
 
 
 
1298
  layout_images.append(dict(
1299
  source=model_logo_uri,
1300
+ xref="x", yref="paper",
1301
+ x=x_log, y=domain_y,
1302
  sizex=SINGLE_SIZE_X, sizey=SINGLE_SIZE_Y,
1303
  xanchor="center", yanchor="middle",
1304
  layer="above",