6405
|
1 ## Copyright (C) 2005 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __go_draw_figure__ (f) |
|
22 ## Display the figure @var{f}. |
|
23 ## @end deftypefn |
|
24 |
|
25 ## Author: jwe |
|
26 |
|
27 function __go_draw_figure__ (f, plot_stream) |
|
28 |
|
29 if (nargin == 2) |
|
30 if (strcmp (f.type, "figure")) |
|
31 |
|
32 ## Set figure properties here? |
|
33 |
|
34 kids = f.children; |
|
35 nkids = length (kids); |
|
36 |
|
37 if (nkids > 0) |
|
38 axes_count = 0; |
|
39 for i = 1:nkids |
|
40 obj = get (kids(i)); |
|
41 switch (obj.type) |
|
42 case "axes" |
|
43 axes_count++; |
|
44 endswitch |
|
45 endfor |
|
46 |
6619
|
47 fputs (plot_stream, "\nreset;\n"); |
6438
|
48 |
6405
|
49 multiplot_mode = axes_count > 1; |
|
50 |
|
51 if (multiplot_mode) |
6438
|
52 fputs (plot_stream, "set multiplot;\n"); |
6405
|
53 endif |
|
54 |
|
55 for i = 1:nkids |
|
56 obj = get (kids(i)); |
|
57 switch (obj.type) |
|
58 case "axes" |
|
59 __go_draw_axes__ (kids(i), plot_stream); |
|
60 |
|
61 otherwise |
|
62 error ("__go_draw_figure__: unknown object class, %s", |
|
63 obj.type); |
|
64 endswitch |
|
65 endfor |
|
66 |
|
67 if (multiplot_mode) |
|
68 fputs (plot_stream, "unset multiplot;\n"); |
|
69 endif |
|
70 else |
6619
|
71 fputs (plot_stream, "\nreset; clear;\n"); |
6405
|
72 fflush (plot_stream); |
|
73 endif |
|
74 else |
|
75 error ("__go_draw_figure__: expecting figure object, found `%s'", |
|
76 f.type); |
|
77 endif |
|
78 else |
|
79 print_usage (); |
|
80 endif |
|
81 |
|
82 endfunction |
|
83 |