Skip to content

Commit

Permalink
Update plot generation to fix too large figures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sohn123 committed Dec 15, 2024
1 parent 45c4f65 commit 78fda14
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions benchmarks/generate_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import pandas as pd
import matplotlib.pyplot as plt
import math

SHOW_PLOTS = False

Expand All @@ -13,13 +14,10 @@ def read_metrics(filename):


def scatter_algos(data, output_file):
# Create a figure for subplots
fig, axs = plt.subplots(1, len(data["algo"].unique()), figsize=(15*len(data["algo"].unique()), 15))
fig.tight_layout(pad=2.0)

# Plotting each category and type combination in its respective subplot
for i, category in enumerate(data["algo"].unique()):
ax = axs[i]
for _, category in enumerate(data["algo"].unique()):
fig, ax = plt.subplots(1, 1, figsize=(15, 15))
fig.tight_layout(pad=2.0)
for type_ in data["options"].unique():

# Filter the data based on category and type
Expand All @@ -36,8 +34,8 @@ def scatter_algos(data, output_file):
ax.grid(True)
ax.legend()

plt.savefig(output_file)
plt.close(fig)
plt.savefig(f"{output_file}_{category}")
plt.close(fig)


def scatter_options(data, output_file):
Expand Down Expand Up @@ -69,23 +67,25 @@ def boxplots(data, output_file):
num_threads = data["threads"].unique()
algos = data["algo"].unique()
options = data["options"].unique()
fig, axs = plt.subplots(len(algos), len(options), figsize=(15*len(options), 15*len(algos)))
fig.tight_layout(pad=5.0)
for x, algo in enumerate(algos):
for _, algo in enumerate(algos):
fig, axs = plt.subplots(1, len(options), figsize=(15*len(options), 15))
fig.tight_layout(pad=5.0)
maximum = data[data["algo"] == algo].max()["time"]
for y, option in enumerate(options):
ax = axs[x, y]
ax = axs[y]
filtered_data = []
for num_thread in num_threads:
filtered_data.append(data[(data["algo"] == algo) & (data["options"] == option) & (data["threads"] == num_thread)]["time"])
ax.boxplot(filtered_data)
ax.set_xticks([y + 1 for y in range(len(filtered_data))],
labels=num_threads)
ax.set_ylim(bottom=0, top=maximum)
ax.set_xlabel('Number of threads')
ax.set_ylabel('Time in ms')
ax.set_title(f"{algo} - {option}")

plt.savefig(output_file)
plt.close(fig)
plt.savefig(f"{output_file}_{algo}")
plt.close(fig)


# Plot performance vs threads
Expand Down

0 comments on commit 78fda14

Please sign in to comment.