You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sledge/runtime/data/plotzhu.py

42 lines
1.3 KiB

# -*- coding: UTF-8 -*-
import matplotlib.pyplot as plt
def plot_max_rps_comparison():
# Data from the previous description
sizes = ['5KB', '40KB', '105KB', '305KB']
max_rps_before = [121, 85, 63, 33]
max_rps_after = [607, 235, 128, 45]
# Index for each bar position along the x-axis
index = range(len(sizes))
bar_width = 0.35 # width of the bars
# Setting up the plot
fig, ax = plt.subplots()
ax.set_facecolor('#f0f0f0')
# Creating bars for "Before Optimization"
rects1 = ax.bar(index, max_rps_before, bar_width, label='Mixed Task', color='orange')
# Creating bars for "After Optimization" shifted to the right by `bar_width`
rects2 = ax.bar([p + bar_width for p in index], max_rps_after, bar_width, label='Single Task', color='skyblue')
# Adding labels and title
ax.set_xlabel('Image Size(KB)')
ax.set_ylabel('MAX RPS')
ax.set_title('Mixed and Single Task Performance Comparison')
# Setting the position of the x-ticks to be in the middle of the grouped bars
ax.set_xticks([p + bar_width / 2 for p in index])
ax.set_xticklabels(sizes)
# Adding a legend to explain which bars represent before and after optimization
ax.legend()
# Displaying the plot
plt.show()
# Call the function to display the plot
plot_max_rps_comparison()