From 8c0c87f74592f3b0a09520fc1b7317ba71d1b892 Mon Sep 17 00:00:00 2001 From: Trygve Date: Thu, 14 Mar 2024 11:23:10 +0100 Subject: [PATCH] 22 --- lab_3/21_and_22/plot_time.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lab_3/21_and_22/plot_time.py diff --git a/lab_3/21_and_22/plot_time.py b/lab_3/21_and_22/plot_time.py new file mode 100644 index 0000000..292486d --- /dev/null +++ b/lab_3/21_and_22/plot_time.py @@ -0,0 +1,21 @@ +import matplotlib.pyplot as plt +import matplotlib.cbook as cbook + +import numpy as np +import pandas as pd + +f = open('time.csv', 'r') +y = [] +for l in f.readlines(): + y.append(float(l)) + +x = range(0, len(y)) +plt.plot(x, y, label = 'time (s)') + +plt.title('Time to run with k queens') +plt.xlabel('k') +plt.ylabel('time (s)') +plt.rcParams['axes.autolimit_mode'] = 'round_numbers' +plt.grid() +plt.legend() +plt.show()