Spaces:
Running
Running
openhands
openhands
commited on
Commit
·
7b4a3a1
1
Parent(s):
5d32e7b
Method A: Fix logo positions for log scale x-axis
Browse filesTransform image x-coordinates to log10(x) since Plotly layout images
expect log-scale coordinates when the axis type is 'log'.
Also adjusted logo size to work better with log scale units.
Co-authored-by: openhands <openhands@all-hands.dev>
- leaderboard_transformer.py +13 -4
leaderboard_transformer.py
CHANGED
|
@@ -570,6 +570,7 @@ def _plot_scatter_plotly(
|
|
| 570 |
))
|
| 571 |
|
| 572 |
# Add company logo images for each data point
|
|
|
|
| 573 |
for _, row in data_plot.iterrows():
|
| 574 |
model_name = row.get('Language Model', '')
|
| 575 |
company_info = get_company_from_model_name(model_name)
|
|
@@ -582,15 +583,23 @@ def _plot_scatter_plotly(
|
|
| 582 |
encoded_logo = base64.b64encode(f.read()).decode('utf-8')
|
| 583 |
logo_uri = f"data:image/svg+xml;base64,{encoded_logo}"
|
| 584 |
|
| 585 |
-
#
|
| 586 |
-
|
| 587 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
|
| 589 |
layout_images.append(dict(
|
| 590 |
source=logo_uri,
|
| 591 |
xref="x",
|
| 592 |
yref="y",
|
| 593 |
-
x=
|
| 594 |
y=row[y_col_to_use],
|
| 595 |
sizex=logo_size_x,
|
| 596 |
sizey=logo_size_y,
|
|
|
|
| 570 |
))
|
| 571 |
|
| 572 |
# Add company logo images for each data point
|
| 573 |
+
# Note: For log scale axes, layout images need log10(x) coordinates
|
| 574 |
for _, row in data_plot.iterrows():
|
| 575 |
model_name = row.get('Language Model', '')
|
| 576 |
company_info = get_company_from_model_name(model_name)
|
|
|
|
| 583 |
encoded_logo = base64.b64encode(f.read()).decode('utf-8')
|
| 584 |
logo_uri = f"data:image/svg+xml;base64,{encoded_logo}"
|
| 585 |
|
| 586 |
+
# Get x position - for log scale, use log10 of the value
|
| 587 |
+
x_val = row[x_col_to_use]
|
| 588 |
+
if x_val > 0:
|
| 589 |
+
x_pos = np.log10(x_val)
|
| 590 |
+
else:
|
| 591 |
+
x_pos = -1 # Place at 0.1 on log scale for zero/negative values
|
| 592 |
+
|
| 593 |
+
# Calculate logo size in log scale units
|
| 594 |
+
# On log scale, a fixed size in log units gives consistent visual size
|
| 595 |
+
logo_size_x = 0.15 # Size in log10 units
|
| 596 |
+
logo_size_y = 2.5 # Fixed y size in data units
|
| 597 |
|
| 598 |
layout_images.append(dict(
|
| 599 |
source=logo_uri,
|
| 600 |
xref="x",
|
| 601 |
yref="y",
|
| 602 |
+
x=x_pos,
|
| 603 |
y=row[y_col_to_use],
|
| 604 |
sizex=logo_size_x,
|
| 605 |
sizey=logo_size_y,
|