From 7774ef986eb4dd0b3be432b27c5c2634495c66e2 Mon Sep 17 00:00:00 2001 From: Dawid Jurkiewicz Date: Fri, 3 Apr 2020 15:06:42 +0200 Subject: [PATCH] Add ploting --- Dockerfile | 3 ++- Jenkinsfile | 5 ++++- plot.py | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3189a0a..11de207 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,5 @@ RUN apt install -y gcc RUN gcc --version RUN apt install -y build-essential RUN apt install -y moreutils -RUN python --version \ No newline at end of file +RUN python --version +RUN pip install matplotlib \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index b15f3b1..84da7b1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,10 @@ pipeline { } stage('Plot') { steps { - sh label: '', script: './plot.py' + sh label: '', script: './plot.py wer.txt wer.png' + sh label: '', script: './plot.py srr.txt srr.png' + archiveArtifacts 'wer.png' + archiveArtifacts 'srr.png' } } } diff --git a/plot.py b/plot.py index 3ac231a..38a46ff 100755 --- a/plot.py +++ b/plot.py @@ -1,7 +1,21 @@ #!/usr/bin/env python +import matplotlib.pyplot as plt +import sys + +def read_file(filename): + values = [] + with open(filename) as f: + for line in f: + values.append(float(line.rstrip('\n'))) + return values + + def main(): - pass + values = read_file(sys.argv[1]) + plt.plot(values) + plt.savefig(sys.argv[2], dpi=1000) + plt.close() if __name__ == "__main__":