import matplotlib.pyplot as plt import numpy as np # Data categories = ['Negligible Local Waveguide Delay', 'With Local Waveguide Delay'] no_input_reuse_time = [3452965, 6839776] no_input_reuse_throughput = [740960/3452965, 740960/6839776] input_reuse_time = [1814173, 3380300] input_reuse_throughput = [558872/1814173, 558872/3380300] x = np.arange(len(categories)) # Label locations width = 0.35 # Width of bars # --- Graph 1: Total Simulation Time --- fig1, ax1 = plt.subplots(figsize=(8, 6)) ax1.bar(x - width/2, no_input_reuse_time, width, label="No Input Reuse", color='blue') ax1.bar(x + width/2, input_reuse_time, width, label="Input Reuse", color='green') ax1.set_xticks(x) ax1.set_xticklabels(categories, rotation=20) ax1.set_ylabel("Total Simulation Time (ns)") ax1.set_title("Total Simulation Time Comparison") ax1.legend() ax1.grid(axis='y', linestyle='--', alpha=0.7) # Save as separate image fig1.savefig("SPACX_Simulation_Time.png", dpi=300, bbox_inches='tight') fig1.savefig("SPACX_Simulation_Time.pdf", bbox_inches='tight') # --- Graph 2: Throughput --- fig2, ax2 = plt.subplots(figsize=(8, 6)) ax2.bar(x - width/2, [val * 1e6 for val in no_input_reuse_throughput], width, label="No Input Reuse", color='lightblue') ax2.bar(x + width/2, [val * 1e6 for val in input_reuse_throughput], width, label="Input Reuse", color='lightgreen') ax2.set_xticks(x) ax2.set_xticklabels(categories, rotation=20) ax2.set_ylabel("Throughput (Packets/ns) * 10⁶") ax2.set_title("Throughput Comparison") ax2.legend() ax2.grid(axis='y', linestyle='--', alpha=0.7) # Save as separate image fig2.savefig("SPACX_Throughput.png", dpi=300, bbox_inches='tight') fig2.savefig("SPACX_Throughput.pdf", bbox_inches='tight') # Show plots # plt.show()