-
Notifications
You must be signed in to change notification settings - Fork 4
/
makeplot
executable file
·87 lines (59 loc) · 1.65 KB
/
makeplot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#! /usr/bin/octave -qf
#graphics_toolkit ("gnuplot")
pkg load signal;
graphicformat = "pdf";
extension = "pdf";
arg_list = argv ();
if nargin > 0
inputf = arg_list{1};
else
printf("%s\n","Input file name missing, exiting...");
return;
endif
if (f = fopen(inputf, "r")) < 0
printf("%s%s%s\n", "File ", inputf, " does not exist, exiting...");
return;
endif
if size(s = getenv("PLOT_TITLE"))
title(s);
endif
# read labels
str = fgetl(f);
labels = strsplit (str);
labels = labels(1:size(labels)(2)-1);
columns = size(labels)(2);
# read data
data = fscanf(f, "%f", [size(labels, 2), Inf])';
temp = strsplit(strrep(inputf, "\\", "/"), "/");
outputf = strsplit(deblank(temp{size(temp, 1), :}), ".");
ylbl = outputf{1,:};
markers = ["*" , "+" , "<" , ">" , "^" , "x" , "o" , "p" , "pentagram" , "s" , "square" , "v" , "diamond" , "h" , "hexagram" ];
colors = [ "b", "c", "r", "g", "m", "y", "r" ];
#samples=0
#sum=0
#newdata = 0
#for i = 1:size(data)(1)
# samples=samples+1
# sum = sum + data(i)
# if (samples==numSamples)
# newdata(size(newdata)(2)i/numSaples) =
# endif
#endfor
samples = 200;
decfactor = round(size(data)(1)/samples);
for i = 2:columns
plot(decimate(data(:,1),decfactor), decimate(data(:,i),decfactor), "marker", markers(i), "color", colors(i), "markersize", 4 );
hold on;
endfor
grid on;
ylbl(1,1) = toupper(ylbl(1,1));
ylabel(ylbl);
xlabel(labels(1));
if size(s = getenv("XLIM"))
xlim([0, str2double(s)]);
endif
legend(labels(:,2:columns), "location", "southoutside");
legend("boxon");
#print -dpdf prova.pdf
eval(cstrcat("print -dpdf ", ylbl, ".", extension));
printf("%s\n","Done!");