Spaces:
Running
Running
openhands
openhands
commited on
Commit
·
46ff970
1
Parent(s):
7b4a3a1
Method B: Use raw data values for layout images (revert log transformation)
Browse filesTesting whether Plotly handles log transformation automatically for layout
images the same way it does for scatter traces.
Co-authored-by: openhands <openhands@all-hands.dev>
- leaderboard_transformer.py +6 -11
leaderboard_transformer.py
CHANGED
|
@@ -570,7 +570,7 @@ def _plot_scatter_plotly(
|
|
| 570 |
))
|
| 571 |
|
| 572 |
# Add company logo images for each data point
|
| 573 |
-
# Note:
|
| 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,23 +583,18 @@ def _plot_scatter_plotly(
|
|
| 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
|
| 594 |
-
#
|
| 595 |
-
logo_size_x = 0.
|
| 596 |
-
logo_size_y = 2.5
|
| 597 |
|
| 598 |
layout_images.append(dict(
|
| 599 |
source=logo_uri,
|
| 600 |
xref="x",
|
| 601 |
yref="y",
|
| 602 |
-
x=
|
| 603 |
y=row[y_col_to_use],
|
| 604 |
sizex=logo_size_x,
|
| 605 |
sizey=logo_size_y,
|
|
|
|
| 570 |
))
|
| 571 |
|
| 572 |
# Add company logo images for each data point
|
| 573 |
+
# Note: With log scale, Plotly layout images use raw data values (same as scatter traces)
|
| 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 |
x_val = row[x_col_to_use]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 587 |
|
| 588 |
+
# Calculate logo size - use percentage of data range
|
| 589 |
+
# For log scale, size is in data units (will be log-scaled by Plotly)
|
| 590 |
+
logo_size_x = max_reported_cost * 0.08 if max_reported_cost > 0 else 0.3
|
| 591 |
+
logo_size_y = 2.5 # Fixed y size in data units
|
| 592 |
|
| 593 |
layout_images.append(dict(
|
| 594 |
source=logo_uri,
|
| 595 |
xref="x",
|
| 596 |
yref="y",
|
| 597 |
+
x=x_val, # Use raw data value - Plotly handles log transformation
|
| 598 |
y=row[y_col_to_use],
|
| 599 |
sizex=logo_size_x,
|
| 600 |
sizey=logo_size_y,
|