You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.6 MiB
1.6 MiB
None
<html>
<head>
</head>
</html>
In [1]:
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import pandas as pd
Importing data¶
In [2]:
med = pd.read_csv('med.csv')
med_discri = pd.read_csv('med_discri.csv')
data_plot= pd.read_csv('data_plot.csv')
Filtering data¶
In [3]:
# 24 Hrs light intensity
luxes = med.iloc[0:288,0]
In [4]:
plt.plot(luxes,'.k')
plt.xlabel('Sample Number')
plt.ylabel('[Lx]', rotation=90)
plt.show()
In [5]:
#Filtering data
def FilteringData(b,e):
filtered_med = med[(med['hh'] >= b ) & (med['hh'] <= e)]
#Saving luxes, temp, hum and power data
luxesf = filtered_med.iloc[:,0].tolist()
tempf = filtered_med.iloc[:,1].tolist()
humf = filtered_med.iloc[:,2].tolist()
powf = filtered_med.iloc[:,5].tolist()
return luxesf, tempf, humf, powf
Plotting data¶
In [6]:
#Graph
# 0,0 - 0,3
def GenGraph(luxesf, tempf, humf, powf):
figure, axis = plt.subplots(4,4, figsize=(8,6))
luxlim=(2055,48000)
templim=(13,50)
humlim=(12,88)
powlim=(0.68,11.61)
#Text fontsize
fontsize=16
Tfont = FontProperties(family='serif', style='normal',size=16)
#Tiles fontsize, family font
font = FontProperties(family='serif',style='italic',size=10)
#Pos x,y Titles
Tx=1.15
Ty=0.36
axis[0,0].text(0.5,0.5,'Lux', verticalalignment='center', horizontalalignment='center',font = Tfont)
for spine in axis[0,0].spines.values():
spine.set_visible(False)
axis[0,1].scatter(luxesf,tempf, s=5, c='none', marker='.', facecolors='none', edgecolors='black', alpha=1)
axis[0,1].set(xlim=luxlim,ylim=templim)
axis[0,1].set_title('a)',y=Ty, x=Tx)
axis[0,2].scatter(luxesf,humf, s=5, c='none', marker='.', facecolors='none', edgecolors='black', alpha=1)
axis[0,2].set(xlim=luxlim,ylim=humlim)
axis[0,2].set_title('b)',y=Ty, x=Tx)
axis[0,3].scatter(luxesf,powf, s=5, c='none', marker='.', facecolors='none', edgecolors='black', alpha=1)
axis[0,3].set(xlim=luxlim,ylim=powlim)
axis[0,3].set_title('c)',y=Ty, x=Tx)
# 1,0 - 1,3
axis[1,0].scatter(tempf,luxesf, s=5, c='none', marker='o', facecolors='none', edgecolors='black', alpha=0.3)
axis[1,0].set_title('d)',y=Ty, x=Tx)
axis[1,0].set(xlim=templim,ylim=luxlim)
axis[1,0].set_ylim(luxlim)
axis[1,1].text(0.5,0.5,'Temp', fontsize=fontsize, verticalalignment='center', horizontalalignment='center', font = Tfont)
for spine in axis[1,1].spines.values():
spine.set_visible(False)
axis[1,2].scatter(tempf,humf, s=5, c='none', marker='.', facecolors='none', edgecolors='black', alpha=1)
axis[1,2].set_title('e)',y=Ty, x=Tx)
axis[1,2].set(xlim=templim,ylim=humlim)
axis[1,3].scatter(tempf,powf, s=5, c='none', marker='.', facecolors='none', edgecolors='black', alpha=1)
axis[1,3].set_title('f)',y=Ty, x=Tx)
axis[1,3].set(xlim=templim,ylim=powlim)
# 2,0 - 2,3
axis[2,0].scatter(humf,luxesf, s=5, c='none', marker='o', facecolors='none', edgecolors='black', alpha=0.3)
axis[2,0].set_title('g)',y=Ty, x=Tx)
axis[2,0].set(xlim=humlim,ylim=luxlim)
axis[2,1].scatter(humf,tempf, s=5, c='none', marker='o', facecolors='none', edgecolors='black', alpha=0.3)
axis[2,1].set_title('h)',y=Ty, x=Tx)
axis[2,1].set(xlim=humlim,ylim=templim)
axis[2,2].text(0.5,0.5,'Hum', fontsize=fontsize, verticalalignment='center', horizontalalignment='center', font = Tfont)
for spine in axis[2,2].spines.values():
spine.set_visible(False)
axis[2,3].scatter(humf,powf, s=5, c='none', marker='.', facecolors='none', edgecolors='black', alpha=1)
axis[2,3].set_title('i)',y=Ty, x=Tx)
axis[2,3].set(xlim=humlim,ylim=powlim)
# 3,0 - 3,3
axis[3,0].scatter(powf,luxesf, s=5, c='none', marker='o', facecolors='none', edgecolors='black', alpha=0.3)
axis[3,0].set_title('j)',y=Ty, x=Tx)
axis[3,0].set(xlim=powlim,ylim=luxlim)
axis[3,1].scatter(powf,tempf, s=5, c='none', marker='o', facecolors='none', edgecolors='black', alpha=0.3)
axis[3,1].set_title('k)',y=Ty, x=Tx)
axis[3,1].set(xlim=powlim,ylim=templim)
axis[3,2].scatter(powf,humf, s=5, c='none', marker='o', facecolors='none', edgecolors='black', alpha=0.3)
axis[3,2].set_title('l)',y=Ty, x=Tx)
axis[3,2].set(xlim=powlim,ylim=humlim)
axis[3,3].text(0.5,0.5,'Pow', fontsize=fontsize, verticalalignment='center', horizontalalignment='center', font = Tfont)
for spine in axis[3,3].spines.values():
spine.set_visible(False)
for ax in axis.flat:
ax.set_xticklabels([])
ax.set_xticks([])
ax.set_yticklabels([])
ax.set_yticks([])
for text in [ax.title]:
text.set_font_properties(font)
plt.subplots_adjust(wspace=0.4,hspace=0.06)
plt.savefig("Graph.png")
plt.show()
Own filtered data¶
In [7]:
luxesf, tempf, humf, powf = FilteringData(9,19)
GenGraph(luxesf,tempf,humf,powf)
Data_plot data base¶
In [8]:
luxesplt = data_plot.iloc[:,0].tolist()
tempplt = data_plot.iloc[:,1].tolist()
humplt = data_plot.iloc[:,2].tolist()
powplt = data_plot.iloc[:,3].tolist()
In [9]:
GenGraph(luxesplt,tempplt,humplt,powplt)
med data base¶
In [10]:
luxesm = med.iloc[:,0].tolist()
tempm = med.iloc[:,1].tolist()
humm = med.iloc[:,2].tolist()
powm = med.iloc[:,5].tolist()
In [11]:
GenGraph(luxesm,tempm,humm,powm)
med_discri data base¶
In [12]:
luxesdi = med_discri.iloc[:,0].tolist()
tempdi = med_discri.iloc[:,1].tolist()
humdi = med_discri.iloc[:,2].tolist()
powdi = med_discri.iloc[:,5].tolist()
In [13]:
GenGraph(luxesdi,tempdi,humdi,powdi)
In [14]:
import numpy as np
def GenGraphTemp(x,y,xlim,ylim,xtitle,ytitle,temp):
fig, ax = plt.subplots(figsize=(7,6))
scatter = ax.scatter(x,y, c=temp, cmap='gray', s=50, edgecolors='none', linewidths=1.5, vmin=0, vmax=70)
ax.set(xlim=xlim,ylim=ylim, xlabel=xtitle, ylabel=ytitle)
ax.grid(True, linestyle='--', linewidth=0.5,alpha=0.7)
ax.tick_params(axis='both', direction='in',length=5,width=1, top=True, right=True)
ColorBar = fig.colorbar(scatter,ax=ax,label='Temp[°C]')
plt.show()
In [34]:
xlim=(2055,51000)
ylim=(1,12)
In [35]:
GenGraphTemp(luxesdi,powdi,xlim,ylim,'Luxes[lx]',"PV's Power[W]",tempdi)
In [36]:
GenGraphTemp(luxesm,powm,xlim,ylim,'Luxes[lx]',"PV's Power[W]",tempm)
In [37]:
GenGraphTemp(luxesf,powf,xlim,ylim,'Luxes[lx]',"PV's Power[W]",tempf)
In [38]:
GenGraphTemp(luxesplt,powplt,xlim,ylim,'Luxes[lx]',"PV's Power[W]",tempplt)
In [31]:
xlim2=(15,100)
In [43]:
GenGraphTemp(humdi,powdi,xlim2,ylim,'Humidity[%]',"PV's Power[W]",tempdi)
In [44]:
GenGraphTemp(humm,powm,xlim2,ylim,'Humidity[%]',"PV's Power[W]",tempm)
In [42]:
GenGraphTemp(humf,powf,xlim2,ylim,'Humidity[%]',"PV's Power[W]",tempf)
In [ ]:
GenGraphTemp(humplt,powplt,xlim2,ylim,'Humidity[%]',"PV's Power[W]",tempplt)