Plot Base Classes
Custom plots subclass BasePlot and implement run(self, benchmark_results). The chart helpers below build on BasePlot and add a create(...) method for common chart types, so most plots subclass one of them rather than BasePlot directly.
BasePlot
Bases: RegisterableComponent, ABC
Base interface for all plot components.
Subclasses should implement the run method.
run(benchmark_results: BenchmarkResultContainer) -> None
abstractmethod
Generate plot output from benchmark results.
Parameters:
-
benchmark_results(BenchmarkResultContainer) –Aggregated benchmark data consumed by the plot implementation.
SeabornPlot
Base of a seaborn-oriented plot with a shared figure and axis configuration.
Requires
Install the 'pre-defined' extra: pip install luna-bench[pre-defined]
setup_figure() -> None
Create a matplotlib figure.
finalize_plot(xlabel: str, ylabel: str, title: str, ylim: tuple[float, float] | None = None, x_rotation: int = 45) -> None
Apply common axis labels, title, limits, and display behavior.
Parameters:
run(benchmark_results: BenchmarkResultContainer) -> None
abstractmethod
Generate plot output from benchmark results.
Parameters:
-
benchmark_results(BenchmarkResultContainer) –Aggregated benchmark data consumed by the plot implementation.
BarPlot
Bases: SeabornPlot, ABC
Base helper for generating aggregated seaborn bar plots.
Requires
Install the 'pre-defined' extra: pip install luna-bench[pre-defined]
create(*, rows: list[dict[str, Any]], xlabel: str, ylabel: str, title: str, x: str = 'x', y: str = 'y', aggregation: Aggregation = Aggregation.MEAN, hue: str | None = None, hline: float | None = None, hline_label: str | None = None, ylim: tuple[float, float] | None = None, legend: bool = False) -> None
Create a bar plot from row-oriented data.
Parameters:
-
rows(dict[str, Any]) –Row-oriented mapping used to construct the plotting DataFrame.
-
xlabel(str) –Label for the x-axis.
-
ylabel(str) –Label for the y-axis.
-
title(str) –Plot title.
-
x(str, default:'x') –Column name mapped to the x-axis, by default
"x". -
y(str, default:'y') –Column name mapped to the y-axis, by default
"y". -
aggregation(Aggregation, default:MEAN) –Aggregation strategy applied by seaborn, by default
Aggregation.MEAN. -
hue(str | None, default:None) –Optional grouping column for grouped bars, by default
None. -
hline(float | None, default:None) –Optional horizontal reference line value, by default
None. -
hline_label(str | None, default:None) –Legend label for the horizontal reference line, by default
None. -
ylim(tuple[float, float] | None, default:None) –Lower and upper y-axis limits, by default
None. -
legend(bool, default:False) –Whether seaborn should create a legend for hue groups, by default
False.
run(benchmark_results: BenchmarkResultContainer) -> None
abstractmethod
Generate plot output from benchmark results.
Parameters:
-
benchmark_results(BenchmarkResultContainer) –Aggregated benchmark data consumed by the plot implementation.
setup_figure() -> None
Create a matplotlib figure.
finalize_plot(xlabel: str, ylabel: str, title: str, ylim: tuple[float, float] | None = None, x_rotation: int = 45) -> None
Apply common axis labels, title, limits, and display behavior.
Parameters:
ScatterPlot
Bases: SeabornPlot, ABC
Base helper for generating seaborn scatter plots.
Requires
Install the 'pre-defined' extra: pip install luna-bench[pre-defined]
create(*, rows: list[dict[str, Any]], xlabel: str, ylabel: str, title: str, hue: str, x: str = 'x', y: str = 'y', hline: float | None = None, hline_label: str | None = None, hcolor: str = AqariosColours.SUCCESS) -> None
Create a scatter plot from row-oriented data.
Parameters:
-
rows(dict[str, Any]) –Row-oriented mapping used to construct the plotting DataFrame.
-
xlabel(str) –Label for the x-axis.
-
ylabel(str) –Label for the y-axis.
-
title(str) –Plot title.
-
hue(str) –Column used to color points by group.
-
x(str, default:'x') –Column name mapped to the x-axis, by default
"x". -
y(str, default:'y') –Column name mapped to the y-axis, by default
"y". -
hline(float | None, default:None) –Optional horizontal reference line value, by default
None. -
hline_label(str | None, default:None) –Legend label for the horizontal reference line, by default
None. -
hcolor(str, default:SUCCESS) –Color of the horizontal reference line, by default
AqariosColours.SUCCESS.
run(benchmark_results: BenchmarkResultContainer) -> None
abstractmethod
Generate plot output from benchmark results.
Parameters:
-
benchmark_results(BenchmarkResultContainer) –Aggregated benchmark data consumed by the plot implementation.
setup_figure() -> None
Create a matplotlib figure.
finalize_plot(xlabel: str, ylabel: str, title: str, ylim: tuple[float, float] | None = None, x_rotation: int = 45) -> None
Apply common axis labels, title, limits, and display behavior.
Parameters: