2847
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
2313
|
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 |
2311
|
20 ## usage: plot_border (...) |
|
21 ## |
|
22 ## NOTE: this will work only with gnuplot installed with |
|
23 ## multiplot patch |
|
24 ## |
|
25 ## Multiple arguments allowed to specify the sides on which the border |
2325
|
26 ## is shown. allowed strings: |
2311
|
27 ## |
|
28 ## allowed input strings: |
|
29 ## |
|
30 ## "blank", "BLANK", "b", "B", ---> No borders displayed |
|
31 ## "all", "ALL", "a", "A", ---> All borders displayed |
|
32 ## "north", "NORTH", "n", "N", ---> North Border |
|
33 ## "south", "SOUTH", "s", "S", ---> South Border |
|
34 ## "east", "EAST", "e", "E", ---> East Border |
|
35 ## "west", "WEST", "w", "W", ---> West Border |
|
36 ## |
|
37 ## Without any arguments, turns borders off. |
1540
|
38 |
2312
|
39 ## Author: Vinayak Dutt <Dutt.Vinayak@mayo.EDU> |
|
40 ## Created: 3 July 95 |
|
41 ## Adapted-By: jwe |
1540
|
42 |
2312
|
43 function plot_border (...) |
1540
|
44 |
2296
|
45 if (! gnuplot_has_multiplot) |
|
46 error ("plot_border: gnuplot does not appear to support this feature"); |
|
47 endif |
2325
|
48 |
1540
|
49 south = 0; |
|
50 west = 0; |
|
51 north = 0; |
|
52 east = 0; |
|
53 all = 0; |
|
54 none = 1; |
|
55 |
|
56 va_start (); |
|
57 |
|
58 while (nargin--) |
|
59 |
|
60 arg = va_arg (); |
|
61 |
|
62 if (! isstr (arg)) |
|
63 error ("plot_border: input not a string"); |
|
64 endif |
|
65 |
2303
|
66 ## The effect of the arguments in cumulative. If something is found |
|
67 ## after "b", do that and ignore "b". |
1540
|
68 |
|
69 if (strcmp (arg, "blank") || strcmp (arg, "BLANK") |
|
70 || strcmp (arg, "b") || strcmp (arg, "B")) |
|
71 none = 1; |
|
72 else |
|
73 none = 0; |
|
74 if (strcmp (arg, "south") || strcmp (arg, "SOUTH") |
|
75 || strcmp (arg, "s") || strcmp (arg, "S")) |
|
76 south = 1; |
|
77 elseif (strcmp (arg, "west") || strcmp (arg, "WEST") |
|
78 || strcmp (arg, "w") || strcmp (arg, "W")) |
|
79 west = 2; |
|
80 elseif (strcmp (arg, "north") || strcmp (arg, "NORTH") |
|
81 || strcmp (arg, "n") || strcmp (arg, "N")) |
|
82 north = 4; |
|
83 elseif (strcmp (arg, "east") || strcmp (arg, "EAST") |
|
84 || strcmp (arg, "e") || strcmp (arg, "E")) |
|
85 east = 8; |
|
86 elseif (strcmp (arg, "all") || strcmp (arg, "ALL") |
|
87 || strcmp (arg, "a") || strcmp (arg, "A")) |
|
88 all = 1; |
|
89 endif |
|
90 endif |
|
91 endwhile |
|
92 |
|
93 if (none) |
2520
|
94 gset noborder; |
1540
|
95 else |
|
96 if (all) |
|
97 border = 15; |
|
98 else |
|
99 border = south + west + north + east; |
|
100 endif |
2520
|
101 eval (sprintf ("gset border %d", border)); |
1540
|
102 endif |
|
103 |
|
104 endfunction |