-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiplot.dart
More file actions
49 lines (40 loc) · 1.13 KB
/
multiplot.dart
File metadata and controls
49 lines (40 loc) · 1.13 KB
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
import 'dart:io';
import 'params.dart';
void multiplot(
var plots, {
var rows=1,
var cols=1,
var format='png',
var out="outMulti",
var width=640,
var height=480,
var scale=1,
})
{
var sameGraph = rows==1&&cols==1;
var str = "" +
"set terminal $format size ${width*scale},${height*scale};" +
"set output '$out.$format';";
if(!sameGraph) {
str += "set multiplot layout $rows,$cols;";
for( var i=0; i<plots.length; i++)
str += plots[i].toString();
str += "unset multiplot;";
} else {
str +=
"set samples ${plots[0].nbPoints};"+
"set isosamples ${plots[0].nbPoints};"+
(plots[0].showZeroX?"set xzeroaxis;":"")+
(plots[0].showZeroY?"set yzeroaxis;":"")+
(plots[0].showGrid?"set grid;":"")+
"set xlabel \"${plots[0].labels.xlabel}\";"+
"set ylabel \"${plots[0].labels.ylabel}\";"+
"set title \" ${plots[0].labels.title }\";"+
"plot [${plots[0].frm}:${plots[0].to}] ";
for( var i=0; i<plots.length; i++)
str += "${plots[i].exp} with ${plots[i].style} lt rgb '${plots[i].color}' lw ${plots[i].lineWidth}, ";
str += ";";
}
str += "set output;";
Process.start('gnuplot', ["-e", str]);
}