Created
June 13, 2018 04:44
-
-
Save lol97/963da5aadd533cc6da3ae95d42345e33 to your computer and use it in GitHub Desktop.
For Make Graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Source Code For Make Graph from data sensor | |
| xsufyan@gmail.com / github.com/lol97 | |
| ''' | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| time,s1,s2,s3,t,ku,ic = np.loadtxt('hasil1.1.txt',dtype='str',delimiter=';',unpack=True) | |
| s1 = s1.astype(np.int) | |
| s2 = s2.astype(np.int) | |
| s3 = s3.astype(np.int) | |
| timeList = [] | |
| s11=[] | |
| s21=[] | |
| s31=[] | |
| rata1 =[] | |
| rata2 =[] | |
| rata3 =[] | |
| for x in time : | |
| timeList.append(int(x[0])) | |
| x = 0 | |
| while (timeList[x]==0): | |
| s11.append(s1[x]) | |
| s21.append(s2[x]) | |
| s31.append(s3[x]) | |
| x+=1 | |
| rata1.append(int(sum(s11)/len(s11))) | |
| rata2.append(int(sum(s21)/len(s21))) | |
| rata3.append(int(sum(s31)/len(s31))) | |
| s12=[] | |
| s22=[] | |
| s32=[] | |
| y = x+0 | |
| while (timeList[y]==1): | |
| s12.append(s1[y]) | |
| s22.append(s2[y]) | |
| s32.append(s3[y]) | |
| y+=1 | |
| rata1.append(int(sum(s12)/len(s12))) | |
| rata2.append(int(sum(s22)/len(s22))) | |
| rata3.append(int(sum(s32)/len(s32))) | |
| s13=[] | |
| s23=[] | |
| s33=[] | |
| z = y+0 | |
| while (timeList[z]==2): | |
| s13.append(s1[z]) | |
| s23.append(s2[z]) | |
| s33.append(s3[z]) | |
| z+=1 | |
| rata1.append(int(sum(s13)/len(s13))) | |
| rata2.append(int(sum(s23)/len(s23))) | |
| rata3.append(int(sum(s33)/len(s33))) | |
| s14=[] | |
| s24=[] | |
| s34=[] | |
| x = z+0 | |
| while (timeList[x]==3): | |
| s14.append(s1[x]) | |
| s24.append(s2[x]) | |
| s34.append(s3[x]) | |
| x+=1 | |
| rata1.append(int(sum(s14)/len(s14))) | |
| rata2.append(int(sum(s24)/len(s24))) | |
| rata3.append(int(sum(s34)/len(s34))) | |
| s15=[] | |
| s25=[] | |
| s35=[] | |
| y = x+0 | |
| while (timeList[y]==4): | |
| s15.append(s1[y]) | |
| s25.append(s2[y]) | |
| s35.append(s3[y]) | |
| y+=1 | |
| rata1.append(int(sum(s15)/len(s15))) | |
| rata2.append(int(sum(s25)/len(s25))) | |
| rata3.append(int(sum(s35)/len(s35))) | |
| plt.subplot(3,1,1) | |
| plt.plot([0,5,10,15,20],rata1) | |
| plt.title("Data Sensor Kelembaban Tanah 1,2,3") | |
| plt.ylabel("Value Sensor 1") | |
| plt.xlabel("tambahan air ml") | |
| plt.subplot(3,1,2) | |
| plt.plot([0,5,10,15,20],rata2) | |
| #plt.title("Data Sensor 2") | |
| plt.ylabel("Value Sensor 2") | |
| plt.xlabel("tambahan air ml") | |
| plt.subplot(3,1,3) | |
| plt.plot([0,5,10,15,20],rata3) | |
| #plt.title("Data Sensor 3") | |
| plt.ylabel("Value Sensor 3") | |
| plt.xlabel("tambahan air ml") | |
| plt.show() | |
| print(rata3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment