Python script update

This commit is contained in:
Damian Michalski 2020-04-03 20:50:18 +02:00
parent 5f287f23eb
commit 92a900376f
4 changed files with 40 additions and 4 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
test.png
wer.png
srr.png
wer.txt
srr.txt
plot.png

7
Jenkinsfile vendored
View File

@ -3,7 +3,12 @@ pipeline {
stages {
stage('Generate plot') {
steps {
sh label: '', script: 'python plot.py'
sh label: '', script: 'python plot.py'
}
}
stage('Archive') {
steps {
archiveArtifacts 'plot.png'
}
}
}

31
plot.py
View File

@ -1,6 +1,31 @@
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.savefig('test.png')
import csv
x1 = []
y1 = []
x2 = []
y2 = []
counter = 0
with open('wer.txt','r') as txtfile:
plots = csv.reader(txtfile)
for row in plots:
x1.append(counter)
y1.append(float(row[0]))
counter += 1
counter = 0
with open('srr.txt','r') as txtfile:
plots = csv.reader(txtfile)
for row in plots:
x2.append(counter)
y2.append(float(row[0]))
counter += 1
plt.plot(x1,y1,x2,y2)
plt.title('Wykres')
plt.legend()
#plt.show()
plt.savefig('plot.png')

BIN
test.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB