Plot median lines with scatter dots for one or more series. Each entry in *series* is (label, dataframe). Colors are looked up from VARIANT_COLORS. The dataframe must contain *x_col* and *y_col* columns.
(
ax: plt.Axes,
series: list[tuple[str, pd.DataFrame]],
x_col: str,
y_col: str,
ylabel: str,
hline: float | None = None,
)
| 130 | 1 - merged["median_tpot_ms_candidate"] / merged["median_tpot_ms_base"] |
| 131 | ) * 100 |
| 132 | frames.append(merged[["max_concurrency", "speedup_pct"]]) |
| 133 | return pd.concat(frames, ignore_index=True) if frames else pd.DataFrame() |
| 134 | |
| 135 | |
| 136 | # --------------------------------------------------------------------------- |
| 137 | # Shared scatter+median line plot |
| 138 | # --------------------------------------------------------------------------- |
| 139 | |
| 140 | FIGSIZE = (6.4, 5) |
| 141 | TPOT_FIGSIZE = (6.0, 5) |
| 142 | DOT_SIZE = 50 |
| 143 | DOT_ALPHA = 0.4 |
| 144 | |
| 145 | |
| 146 | def _plot_scatter_line( |
| 147 | ax: plt.Axes, |
| 148 | series: list[tuple[str, pd.DataFrame]], |
| 149 | x_col: str, |
| 150 | y_col: str, |
| 151 | ylabel: str, |
| 152 | hline: float | None = None, |
| 153 | ): |
| 154 | """Plot median lines with scatter dots for one or more series. |
| 155 | |
| 156 | Each entry in *series* is (label, dataframe). Colors are looked up from |
| 157 | VARIANT_COLORS. The dataframe must contain *x_col* and *y_col* columns. |
| 158 | """ |
| 159 | all_x = set() |
| 160 | for label, sdf in series: |
| 161 | color = VARIANT_COLORS[label] |
| 162 | marker = VARIANT_MARKERS.get(label, "o") |
| 163 | medians = sdf.groupby(x_col)[y_col].median() |
| 164 | ax.plot(medians.index, medians.values, marker=marker, color=color, label=label, zorder=3) |
| 165 | ax.scatter( |
| 166 | sdf[x_col], |
| 167 | sdf[y_col], |
| 168 | color=color, |
| 169 | alpha=DOT_ALPHA, |
| 170 | s=DOT_SIZE, |
| 171 | zorder=2, |
| 172 | edgecolors="none", |
no outgoing calls
no test coverage detected