# Csar Fdez, UdL, 2025
# Plots paper's bar plots of FSCore
import matplotlib.pyplot as plt
import numpy as np

F={}   # FScore in stationary phase
      # first index:  time series length, second index: features considered 
for i in range(4,27,4):
    F[i]=np.ones(6)
#for i in range(4,27,4):
#    for j in range(6):
#        F[i][j]=np.random.uniform(0.8,1)

F[4]= [0.99,0.99,0.97,0.96,0.98,0.9  ]
F[8]= [1,1,0.99,0.98,0.99,0.96  ]
F[12]=[1,1,0.99,0.96,0.99, 0.65 ]
F[16]=[1,1,1,0.98,0.99 ,0.67 ]
F[20]=[1,1,1,0.98 ,1, 0.67 ]
F[24]=[1,1,1,1,1, 0.66  ]


plt.rcParams.update({'font.size': 16})
fig, axes = plt.subplots( nrows=1, ncols=1, figsize=(15, 6), dpi=80, facecolor="w", edgecolor="k",sharex=True)
width=0.1
for i in range(4,27,4):
    axes.bar(np.arange(0,6)+(i/4-3)*width , F[i], width*0.8, label="$ns=$"+str(i), align="center")
axes.set_ylim(0.6,1.01)
axes.legend(loc='center right')
axes.set_ylabel("F1-Score")
axes.set_xticks([0,1,2,3,4,5],['$T_{evap},T_{cond}$ \n $T_{air},P_{elec}$','$T_{evap},T_{cond},T_{air}$','$T_{evap},T_{air},P_{elec}$','$T_{air},P_{elec}$','$T_{evap},T_{air}$','$T_{air}$'])
plt.grid()
plt.show()

# https://stackoverflow.com/questions/10369681/how-to-plot-bar-graphs-with-same-x-coordinates-side-by-side-dodged

print(F)
