Skip to content

Commit c9e9a6a

Browse files
committed
Merge remote-tracking branch 'origin/master'
Change-Id: I5e562b249e8f7ffa6d5296fa39dba4b536a88286 Signed-off-by: panacotta <[email protected]>
2 parents 542b485 + 61d7b1e commit c9e9a6a

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

papiplot/src/plot.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,44 @@ int main(int argc, char **argv) {
2121
"\nIf not installed, you need to install gnuplot. In Ubuntu run:\n"
2222
"sudo apt-get install gnuplot\n",
2323
argv[0]);
24-
2524
exit(0);
2625
}
2726
char* path = malloc(strlen(argv[1]));
2827
strcpy(path, argv[1]);
2928

29+
plot(path);
30+
31+
return 0;
32+
}
33+
34+
void plot(char *path) {
3035
gnuplot_ctrl * h ;
3136
h = gnuplot_init() ;
3237

38+
int n = 2; //number of events
39+
40+
41+
gnuplot_cmd(h, "reset");
42+
gnuplot_cmd(h, "dx=5.");
43+
gnuplot_cmd(h, "n=%d", n);
44+
gnuplot_cmd(h, "total_box_width_relative=0.75");
45+
gnuplot_cmd(h, "gap_width_relative=0.1");
46+
gnuplot_cmd(h, "d_width=(gap_width_relative+total_box_width_relative)*dx/2.");
3347
gnuplot_cmd(h, "reset");
3448

3549
gnuplot_cmd(h,"list = ''");
3650
gnuplot_cmd(h,"index(w) = words(substr(list, 0, strstrt(list, w)-1))");
3751
gnuplot_cmd(h,"add_label(d) = (strstrt(list, d) == 0 ? list=list.' '.d : '')");
38-
3952
gnuplot_cmd(h, "set datafile separator \";\"");
4053
gnuplot_cmd(h, "set xtics rotate");
4154
//gnuplot_cmd(h, "set logscale y");
42-
4355
gnuplot_cmd(h, "plot \"%s\" "
44-
"every ::1 using (d='|'.strcol(2).'|', add_label(d),index(d)):3:xtic(2) smooth frequency w boxes title \"PAPI TOT INS\"",
56+
"every ::1 using (d='|'.strcol(2).'|', add_label(d),index(d)):3:xtic(2) smooth frequency w boxes lc rgb\"green\" title \"PAPI TOT INS\"",
4557
path);
4658

47-
sleep(50000000);
4859

49-
return 0;
60+
61+
/* plot "profit.dat" u 1:2 w boxes lc rgb"green" notitle,\
62+
"profit.dat" u ($1+d_width):3 w boxes lc rgb"red" notitle*/
63+
sleep(50000000);
5064
}

0 commit comments

Comments
 (0)