(
plot_dir: str,
data: pd.DataFrame,
value: str,
title: str,
slug: str,
data_label: str,
normalized_label: str,
x: str,
)
| 4469 | |
| 4470 | |
| 4471 | def plot( |
| 4472 | plot_dir: str, |
| 4473 | data: pd.DataFrame, |
| 4474 | value: str, |
| 4475 | title: str, |
| 4476 | slug: str, |
| 4477 | data_label: str, |
| 4478 | normalized_label: str, |
| 4479 | x: str, |
| 4480 | ): |
| 4481 | df2 = data.pivot_table( |
| 4482 | index=[x], |
| 4483 | columns=["test_name"], |
| 4484 | values=value, |
| 4485 | aggfunc="min", |
| 4486 | ).sort_index(axis=1) |
| 4487 | filtered = df2.dropna(axis=1, how="all") |
| 4488 | if filtered.empty: |
| 4489 | print(f"Warning: No data to plot for {title}") |
| 4490 | return |
| 4491 | filtered.index.name = x |
| 4492 | plot = filtered.plot( |
| 4493 | kind="bar", |
| 4494 | figsize=(12, 6), |
| 4495 | ylabel=data_label, |
| 4496 | logy=False, |
| 4497 | title=f"{title}", |
| 4498 | grid=True, |
| 4499 | ) |
| 4500 | plot.set_xlabel(x) |
| 4501 | plot.legend( |
| 4502 | loc="upper left", |
| 4503 | bbox_to_anchor=(1.0, 1.0), |
| 4504 | ) |
| 4505 | save_plot(plot_dir, filtered, title, slug) |
| 4506 | |
| 4507 | filtered = filtered.div(filtered.iloc[0]) |
| 4508 | plot = filtered.plot( |
| 4509 | kind="bar", |
| 4510 | figsize=(12, 6), |
| 4511 | ylabel=normalized_label, |
| 4512 | logy=False, |
| 4513 | title=f"{title}", |
| 4514 | grid=True, |
| 4515 | ) |
| 4516 | plot.set_xlabel(x) |
| 4517 | plot.legend( |
| 4518 | loc="upper left", |
| 4519 | bbox_to_anchor=(1.0, 1.0), |
| 4520 | ) |
| 4521 | save_plot(plot_dir, filtered, f"{title} (Normalized)", f"{slug}_normalized") |
| 4522 | |
| 4523 | |
| 4524 | def upload_cluster_results_to_test_analytics( |
no test coverage detected