2303
|
1 ### Copyright (C) 1996 John W. Eaton |
|
2 ### |
|
3 ### This file is part of Octave. |
|
4 ### |
|
5 ### Octave is free software; you can redistribute it and/or modify it |
|
6 ### under the terms of the GNU General Public License as published by |
|
7 ### the Free Software Foundation; either version 2, or (at your option) |
|
8 ### any later version. |
|
9 ### |
|
10 ### Octave is distributed in the hope that it will be useful, but |
|
11 ### WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ### General Public License for more details. |
|
14 ### |
|
15 ### You should have received a copy of the GNU General Public License |
|
16 ### along with Octave; see the file COPYING. If not, write to the Free |
|
17 ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
18 ### 02111-1307, USA. |
1540
|
19 |
|
20 function plot_border (...) |
|
21 |
2303
|
22 ## usage: plot_border (...) |
|
23 ## |
|
24 ## NOTE: this will work only with gnuplot installed with |
|
25 ## multiplot patch |
|
26 ## |
|
27 ## Multiple arguments allowed to specify the sides on which the border |
|
28 ## is shown. allowed strings: |
|
29 ## |
|
30 ## allowed input strings: |
|
31 ## |
|
32 ## "blank", "BLANK", "b", "B", ---> No borders displayed |
|
33 ## "all", "ALL", "a", "A", ---> All borders displayed |
|
34 ## "north", "NORTH", "n", "N", ---> North Border |
|
35 ## "south", "SOUTH", "s", "S", ---> South Border |
|
36 ## "east", "EAST", "e", "E", ---> East Border |
|
37 ## "west", "WEST", "w", "W", ---> West Border |
|
38 ## |
|
39 ## Without any arguments, turns borders off. |
1540
|
40 |
2303
|
41 ## Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU 3 Jul 95 |
1540
|
42 |
2296
|
43 if (! gnuplot_has_multiplot) |
|
44 error ("plot_border: gnuplot does not appear to support this feature"); |
|
45 endif |
|
46 |
1540
|
47 south = 0; |
|
48 west = 0; |
|
49 north = 0; |
|
50 east = 0; |
|
51 all = 0; |
|
52 none = 1; |
|
53 |
|
54 va_start (); |
|
55 |
|
56 while (nargin--) |
|
57 |
|
58 arg = va_arg (); |
|
59 |
|
60 if (! isstr (arg)) |
|
61 error ("plot_border: input not a string"); |
|
62 endif |
|
63 |
2303
|
64 ## The effect of the arguments in cumulative. If something is found |
|
65 ## after "b", do that and ignore "b". |
1540
|
66 |
|
67 if (strcmp (arg, "blank") || strcmp (arg, "BLANK") |
|
68 || strcmp (arg, "b") || strcmp (arg, "B")) |
|
69 none = 1; |
|
70 else |
|
71 none = 0; |
|
72 if (strcmp (arg, "south") || strcmp (arg, "SOUTH") |
|
73 || strcmp (arg, "s") || strcmp (arg, "S")) |
|
74 south = 1; |
|
75 elseif (strcmp (arg, "west") || strcmp (arg, "WEST") |
|
76 || strcmp (arg, "w") || strcmp (arg, "W")) |
|
77 west = 2; |
|
78 elseif (strcmp (arg, "north") || strcmp (arg, "NORTH") |
|
79 || strcmp (arg, "n") || strcmp (arg, "N")) |
|
80 north = 4; |
|
81 elseif (strcmp (arg, "east") || strcmp (arg, "EAST") |
|
82 || strcmp (arg, "e") || strcmp (arg, "E")) |
|
83 east = 8; |
|
84 elseif (strcmp (arg, "all") || strcmp (arg, "ALL") |
|
85 || strcmp (arg, "a") || strcmp (arg, "A")) |
|
86 all = 1; |
|
87 endif |
|
88 endif |
|
89 endwhile |
|
90 |
|
91 if (none) |
1557
|
92 set noborder; |
1540
|
93 else |
|
94 if (all) |
|
95 border = 15; |
|
96 else |
|
97 border = south + west + north + east; |
|
98 endif |
|
99 eval (sprintf ("set border %d", border)); |
|
100 endif |
|
101 |
|
102 endfunction |