diff --git a/hack/e2e/perf/viz/generate_graph.py b/hack/e2e/perf/viz/generate_graph.py index 352c3d26..a0bb4381 100644 --- a/hack/e2e/perf/viz/generate_graph.py +++ b/hack/e2e/perf/viz/generate_graph.py @@ -17,14 +17,22 @@ workers_main = [item['workers'] for item in data_main] time_main = [item['time'] for item in data_main] +# Sort the data by workers to ensure correct plotting order +sorted_pr = sorted(zip(workers_pr, time_pr), key=lambda x: x[0]) +sorted_main = sorted(zip(workers_main, time_main), key=lambda x: x[0]) + +# Unzip the sorted data +workers_pr_sorted, time_pr_sorted = zip(*sorted_pr) +workers_main_sorted, time_main_sorted = zip(*sorted_main) + # Create a plot plt.figure(figsize=(10, 6)) -# Plot data from 'perf-data-PR.json' -plt.plot(workers_pr, time_pr, marker='o', linestyle='-', label='PR Branch') +# Plot sorted data from 'perf-data-PR.json' +plt.plot(workers_pr_sorted, time_pr_sorted, marker='o', linestyle='-', label='PR Branch') -# Plot data from 'perf-data-main.json' -plt.plot(workers_main, time_main, marker='x', linestyle='--', label='Main Branch') +# Plot sorted data from 'perf-data-main.json' +plt.plot(workers_main_sorted, time_main_sorted, marker='x', linestyle='--', label='Main Branch') # Add title, labels, grid, and legend plt.title('Time Taken by UffizziClusters with Varying Workers')