import pandas as pd 
import numpy as np 
import matplotlib.pyplot as plt

time_data = pd.read_csv('results/data_t_e.txt', header=None, delim_whitespace=True)
n = time_data.loc[:, 0]
half = (len(time_data.columns) - 1) // 2
stand = time_data.loc[:, 1:half]
naive = time_data.loc[:, half+1:]

def plot_to_f(data, filename, time_s):
    data = data.T
    data.columns = n
    myplot = data.boxplot(return_type='axes', rot=35)
    myplot.axes.set_xlabel("Parameter n")
    myplot.axes.set_ylabel("Time in " + time_s)
    for item in myplot.axes.get_yticklabels():
        item.set_rotation(45)
    plt.subplots_adjust(wspace=0.9, hspace=0.9, left=0.12, bottom=0.13, right=0.96, top=0.9)
    plt.savefig(filename)

plot_to_f(stand, 'figs/standartd.pdf', "seconds (units are 10^-9s)")
plot_to_f(naive, 'figs/naive.pdf', "seconds")

