Skip to content

Commit 944e47e

Browse files
committed
sort and plot
1 parent 72e26d5 commit 944e47e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

hack/e2e/perf/viz/generate_graph.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@
1717
workers_main = [item['workers'] for item in data_main]
1818
time_main = [item['time'] for item in data_main]
1919

20+
# Sort the data by workers to ensure correct plotting order
21+
sorted_pr = sorted(zip(workers_pr, time_pr), key=lambda x: x[0])
22+
sorted_main = sorted(zip(workers_main, time_main), key=lambda x: x[0])
23+
24+
# Unzip the sorted data
25+
workers_pr_sorted, time_pr_sorted = zip(*sorted_pr)
26+
workers_main_sorted, time_main_sorted = zip(*sorted_main)
27+
2028
# Create a plot
2129
plt.figure(figsize=(10, 6))
2230

23-
# Plot data from 'perf-data-PR.json'
24-
plt.plot(workers_pr, time_pr, marker='o', linestyle='-', label='PR Branch')
31+
# Plot sorted data from 'perf-data-PR.json'
32+
plt.plot(workers_pr_sorted, time_pr_sorted, marker='o', linestyle='-', label='PR Branch')
2533

26-
# Plot data from 'perf-data-main.json'
27-
plt.plot(workers_main, time_main, marker='x', linestyle='--', label='Main Branch')
34+
# Plot sorted data from 'perf-data-main.json'
35+
plt.plot(workers_main_sorted, time_main_sorted, marker='x', linestyle='--', label='Main Branch')
2836

2937
# Add title, labels, grid, and legend
3038
plt.title('Time Taken by UffizziClusters with Varying Workers')

0 commit comments

Comments
 (0)