Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2071 | zjchen | 1 | !goto $wims_read_parm |
2 | |||
3 | :def |
||
4 | title=2D data plot |
||
5 | synonyme=data plot 2D, 2D data plot |
||
6 | input=data2d |
||
7 | !exit |
||
8 | |||
9 | :proc |
||
10 | |||
11 | cnt=!linecnt $fml |
||
12 | l1=!line 1 of $fml |
||
13 | !distribute item $l1 into x1,y1 |
||
14 | xmin=$[$x1] |
||
15 | xmax=$[$x1] |
||
16 | ymin=$[$y1] |
||
17 | ymax=$[$y1] |
||
18 | insplot_data=$[$x1] $[$y1] |
||
19 | !for i=2 to $cnt |
||
20 | l=!line $i of $fml |
||
21 | !distribute item $l into x_,y_ |
||
22 | xmin=$[min($xmin,$x_)] |
||
23 | xmax=$[max($xmax,$x_)] |
||
24 | ymin=$[min($ymin,$y_)] |
||
25 | ymax=$[max($ymax,$y_)] |
||
26 | insplot_data=!append line $[$x_] $[$y_] to $insplot_data |
||
27 | !next i |
||
28 | |||
29 | xrange=$[max((abs($xmin)+abs($xmax))/10000,0.000000001)] |
||
30 | yrange=$[max((abs($ymin)+abs($ymax))/10000,0.000000001)] |
||
31 | xdiff=$[max($xrange,0.1*($xmax-($xmin)))] |
||
32 | x1=$[$xmin-$xdiff] |
||
33 | x2=$[$xmax+$xdiff] |
||
34 | ydiff=$[max($yrange,0.1*($ymax-($ymin)))] |
||
35 | y1=$[$ymin-$ydiff] |
||
36 | y2=$[$ymax+$ydiff] |
||
37 | |||
38 | insplot_set=size $[$picx/500], $[$picy/400] |
||
39 | !insplot [$x1:$x2] [$y1:$y2] 'insplot_data' notitle with points pt 4 |
||
40 | result=$ins_out |
||
41 | !if getins notin $result |
||
42 | result= |
||
43 | !endif |
||
44 | |||
45 | !exit |
||
46 | |||
47 | :output |
||
48 | |||
49 | <center> |
||
50 | $result |
||
51 | </center> <p> |
||
52 | Plotted data: $cnt pairs { $fml3 } |
||
53 | <p> |
||
54 | !exit |
||
55 |