Stage2024/tracking_sources/frametime.py
2024-06-28 14:08:49 +02:00

31 lines
951 B
Python

import matplotlib.pyplot as plt
def plot_graph(file_path):
# Read the file and extract the floats
with open(file_path, 'r') as file:
values1 = []
values2 = []
values3 = []
for line in file:
float1, float2, float3 = map(float, line.strip().split())
values1.append(float1)
values2.append(float2)
values3.append(float3)
# Generate x-axis values (assuming each float pair is a data point)
x_values = list(range(1, len(values1) + 1))
# Plot the graph
plt.plot(x_values, values1, label='requete')
plt.plot(x_values, values2, label='traitement') # Plot the graph
plt.plot(x_values, values3, label='total')
plt.title('Temps pour traiter une image')
plt.xlabel("numero de l'image")
plt.ylabel('temps (s)')
plt.grid(True)
plt.legend()
plt.xlim(left=0)
plt.ylim(bottom=0)
plt.show()
plot_graph("frametime.txt")