7017
|
1 ## Copyright (C) 2005, 2007 John W. Eaton |
6405
|
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 |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
6405
|
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 |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
6405
|
18 |
6895
|
19 ## Undocumented internal function. |
6405
|
20 |
|
21 ## Author: jwe |
|
22 |
|
23 function __go_draw_figure__ (f, plot_stream) |
|
24 |
|
25 if (nargin == 2) |
|
26 if (strcmp (f.type, "figure")) |
|
27 |
|
28 ## Set figure properties here? |
|
29 |
|
30 kids = f.children; |
|
31 nkids = length (kids); |
|
32 |
|
33 if (nkids > 0) |
|
34 axes_count = 0; |
|
35 for i = 1:nkids |
|
36 obj = get (kids(i)); |
|
37 switch (obj.type) |
|
38 case "axes" |
|
39 axes_count++; |
|
40 endswitch |
|
41 endfor |
|
42 |
6619
|
43 fputs (plot_stream, "\nreset;\n"); |
6438
|
44 |
6405
|
45 multiplot_mode = axes_count > 1; |
|
46 |
|
47 if (multiplot_mode) |
6438
|
48 fputs (plot_stream, "set multiplot;\n"); |
6405
|
49 endif |
|
50 |
|
51 for i = 1:nkids |
|
52 obj = get (kids(i)); |
|
53 switch (obj.type) |
|
54 case "axes" |
|
55 __go_draw_axes__ (kids(i), plot_stream); |
|
56 |
|
57 otherwise |
|
58 error ("__go_draw_figure__: unknown object class, %s", |
|
59 obj.type); |
|
60 endswitch |
|
61 endfor |
|
62 |
|
63 if (multiplot_mode) |
|
64 fputs (plot_stream, "unset multiplot;\n"); |
|
65 endif |
|
66 else |
6619
|
67 fputs (plot_stream, "\nreset; clear;\n"); |
6405
|
68 fflush (plot_stream); |
|
69 endif |
|
70 else |
|
71 error ("__go_draw_figure__: expecting figure object, found `%s'", |
|
72 f.type); |
|
73 endif |
|
74 else |
|
75 print_usage (); |
|
76 endif |
|
77 |
|
78 endfunction |
|
79 |