Skip to content

Commit

Permalink
Merge pull request #319 from opencompl/christos/add-plotting-scripts
Browse files Browse the repository at this point in the history
Add plotting scripts from paper for artifact reproduction
  • Loading branch information
compor authored Nov 8, 2024
2 parents 7a3c617 + 16fe0a7 commit 8b6ab14
Show file tree
Hide file tree
Showing 24 changed files with 1,714 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ JOBS ?= all

THIS := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))

.PHONY: default fast all clean
.PHONY: default fast all clean artifact

default: fast

artifact: fast all low_level_representation pipeline

fast: maybe_update_xdsl_commit
snakemake --cores $(JOBS) --rerun-incomplete fast

Expand Down
Empty file added plots-cgo2025-ae/__init__.py
Empty file.
36 changes: 36 additions & 0 deletions plots-cgo2025-ae/config/cycles/all_barchart.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"axis": {
"xlabel": {
"label": ""
},
"ylabel": {
"label": "Cycles",
"rotation": "horizontal",
"position": [1.0, 1.05],
"horizontalalignment": "left",
"verticalalignment": "bottom"
},
"ylim": [
0,
5000
],
"xticks": {
"labelrotation": 45
}
},
"legend": {
"ncol": 50,
"bbox_to_anchor": [0, 1, 1, 0],
"loc": "lower right"
},
"spines" : {
"left": {
"color": "black",
"linewidth": 0.4
},
"bottom": {
"color": "black",
"linewidth": 0.4
}
}
}
74 changes: 74 additions & 0 deletions plots-cgo2025-ae/config/cycles/all_barchart.mplstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# vim: ft=config

## Use TrueType fonts instead of Type 3 fonts
#
# Type 3 fonts embed bitmaps and are not allowed in camera-ready submissions
# for many conferences. TrueType fonts look better and are accepted.
# This follows: https://www.conference-publishing.com/Help.php
pdf.fonttype: 42
ps.fonttype: 42

font.size: 12
#font.family: serif
font.family: sans-serif
#font.sans-serif: ["Helvetica"]

text.usetex: False

## Enable tight_layout by default
#
# This ensures the plot has always sufficient space for legends, ...
# Without this sometimes parts of the figure would be cut off.
figure.autolayout: True

#figure.figsize: 3, 2.5
figure.figsize: 4, 2.5

legend.frameon: False
legend.fontsize: 8
legend.loc: upper right
legend.fancybox: False
legend.framealpha: 1.0
legend.shadow: False
legend.borderaxespad: 0
legend.edgecolor: gray
legend.handleheight: 1
legend.labelspacing: 0.2
legend.columnspacing: 0.4
legend.handletextpad: 0.2

patch.edgecolor: black
patch.force_edgecolor: False
patch.linewidth: 0.4

xtick.top: False
xtick.bottom: True
xtick.major.size: 3
xtick.major.width: 0.4

ytick.left: True
ytick.right: False
ytick.direction: out
ytick.major.size: 3
ytick.major.width: 0.4

axes.grid.axis: y
axes.grid: True

# Hide the right and top spines
#
# This reduces the number of lines in the plot. Lines typically catch
# a readers attention and distract the reader from the actual content.
# By removing unnecessary spines, we help the reader to focus on
# the figures in the graph.
axes.spines.right: False
axes.spines.top: False

grid.color: black
grid.alpha: 0.2
grid.linewidth: 0.4
grid.linestyle: dotted


savefig.bbox: tight
savefig.pad_inches: 0.05
36 changes: 36 additions & 0 deletions plots-cgo2025-ae/config/cycles/xdsl_barchart.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"axis": {
"xlabel": {
"label": ""
},
"ylabel": {
"label": "Cycles",
"rotation": "horizontal",
"position": [1.0, 1.05],
"horizontalalignment": "left",
"verticalalignment": "bottom"
},
"ylim": [
0,
5000
],
"xticks": {
"labelrotation": 0
}
},
"legend": {
"ncol": 50,
"bbox_to_anchor": [0, 1, 1, 0],
"loc": "lower right"
},
"spines" : {
"left": {
"color": "black",
"linewidth": 0.4
},
"bottom": {
"color": "black",
"linewidth": 0.4
}
}
}
74 changes: 74 additions & 0 deletions plots-cgo2025-ae/config/cycles/xdsl_barchart.mplstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# vim: ft=config

## Use TrueType fonts instead of Type 3 fonts
#
# Type 3 fonts embed bitmaps and are not allowed in camera-ready submissions
# for many conferences. TrueType fonts look better and are accepted.
# This follows: https://www.conference-publishing.com/Help.php
pdf.fonttype: 42
ps.fonttype: 42

font.size: 12
#font.family: serif
font.family: sans-serif
#font.sans-serif: ["Helvetica"]

text.usetex: False

## Enable tight_layout by default
#
# This ensures the plot has always sufficient space for legends, ...
# Without this sometimes parts of the figure would be cut off.
figure.autolayout: True

#figure.figsize: 3, 2.5
figure.figsize: 3, 2

legend.frameon: False
legend.fontsize: 8
legend.loc: upper right
legend.fancybox: False
legend.framealpha: 1.0
legend.shadow: False
legend.borderaxespad: 0
legend.edgecolor: gray
legend.handleheight: 1
legend.labelspacing: 0.2
legend.columnspacing: 0.4
legend.handletextpad: 0.2

patch.edgecolor: black
patch.force_edgecolor: False
patch.linewidth: 0.4

xtick.top: False
xtick.bottom: True
xtick.major.size: 3
xtick.major.width: 0.4

ytick.left: True
ytick.right: False
ytick.direction: out
ytick.major.size: 3
ytick.major.width: 0.4

axes.grid.axis: y
axes.grid: True

# Hide the right and top spines
#
# This reduces the number of lines in the plot. Lines typically catch
# a readers attention and distract the reader from the actual content.
# By removing unnecessary spines, we help the reader to focus on
# the figures in the graph.
axes.spines.right: False
axes.spines.top: False

grid.color: black
grid.alpha: 0.2
grid.linewidth: 0.4
grid.linestyle: dotted


savefig.bbox: tight
savefig.pad_inches: 0.05
70 changes: 70 additions & 0 deletions plots-cgo2025-ae/config/gridplot.mplstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# vim: ft=config

## Use TrueType fonts instead of Type 3 fonts
#
# Type 3 fonts embed bitmaps and are not allowed in camera-ready submissions
# for many conferences. TrueType fonts look better and are accepted.
# This follows: https://www.conference-publishing.com/Help.php
pdf.fonttype: 42
ps.fonttype: 42

font.size: 12
#font.family: serif
font.family: sans-serif
#font.sans-serif: ["Helvetica"]

text.usetex: False

## Enable tight_layout by default
#
# This ensures the plot has always sufficient space for legends, ...
# Without this sometimes parts of the figure would be cut off.
figure.autolayout: True

#figure.figsize: 3, 2.5
#figure.figsize: 4, 2.5

legend.frameon: False
legend.fontsize: 14
legend.loc: upper center
legend.fancybox: False
legend.framealpha: 1.0
legend.shadow: False
legend.borderaxespad: 0
legend.edgecolor: gray
legend.handleheight: 1
legend.labelspacing: 0.1
legend.columnspacing: 0.8
legend.handletextpad: 0.1

xtick.top: False
xtick.bottom: True
xtick.major.size: 3
xtick.major.width: 0.4

ytick.left: True
ytick.right: False
ytick.direction: out
ytick.major.size: 3
ytick.major.width: 0.4

axes.grid.axis: y
axes.grid: True

# Hide the right and top spines
#
# This reduces the number of lines in the plot. Lines typically catch
# a readers attention and distract the reader from the actual content.
# By removing unnecessary spines, we help the reader to focus on
# the figures in the graph.
axes.spines.right: False
axes.spines.top: False

grid.color: black
grid.alpha: 0.2
grid.linewidth: 0.4
grid.linestyle: dashed


savefig.bbox: tight
savefig.pad_inches: 0.02
47 changes: 47 additions & 0 deletions plots-cgo2025-ae/cycles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from typing import Iterable, Sequence, cast
import pandas as pd
import numpy as np
import numpy.typing as npt
from plot_utils import IMPL_COLORS, IMPL_MARKERS, plot_combined, GridPlotRow
from matplotlib.axes import Axes

from math import log10, ceil, floor


class CyclesGridPlotRow(GridPlotRow):
ylabel = "Cycles"

@classmethod
def yrange(cls, dfs: Sequence[pd.DataFrame]) -> npt.NDArray[np.float64]:
max_value = cast(float, max(_df.max().iloc[0] for _df in dfs))
magnitude: float = 10 ** floor(log10(max_value))
greater_round_number = ceil(max_value / magnitude) * magnitude
yrange = np.arange(0, greater_round_number + 1, greater_round_number // 10)
return yrange

@classmethod
def plot_grid_cell(
cls,
ax: Axes,
df: pd.DataFrame,
*,
hide_xlabel: bool,
) -> None:
for col in df:
ax.scatter(
x=df.index,
y=df[col],
color=IMPL_COLORS[col],
marker=IMPL_MARKERS[col],
)
ax.set_xticks(df.index)
if not hide_xlabel:
ax.set_xlabel(df.index.name, fontsize=12)


def plot_cycles(cycles_dfs: tuple[pd.DataFrame, ...]):
return plot_combined(
CyclesGridPlotRow.get_rows(cycles_dfs, 4),
legend_cols=3,
rcparams_cfg_file="config/gridplot.mplstyle",
)
Loading

0 comments on commit 8b6ab14

Please sign in to comment.