blob: a7a0e01e2d4e0cc43d033c3ab6cdceab79716311 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# SPDX-License-Identifier: GPL-2.0
import os
import subprocess
'return error'
def plot_dist(data_file, output_file, xlabel, ylabel):
terminal = output_file.split('.')[-1]
if not terminal in ['pdf', 'jpeg', 'png', 'svg']:
os.remove(data_file)
return 'Unsupported plot output type.'
gnuplot_cmd = """
set term %s;
set output '%s';
set key off;
set xlabel '%s';
set ylabel '%s';
plot '%s' with linespoints;""" % (terminal, output_file, xlabel, ylabel,
data_file)
subprocess.call(['gnuplot', '-e', gnuplot_cmd])
os.remove(data_file)
return None
|