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 |
7269
|
23 function __go_draw_figure__ (f, plot_stream, enhanced, mono) |
6405
|
24 |
7269
|
25 if (nargin == 4) |
6405
|
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 |
7379
|
36 obj = __get__ (kids(i)); |
6405
|
37 switch (obj.type) |
|
38 case "axes" |
|
39 axes_count++; |
7202
|
40 ## Force multiplot with a colorbar to ensure colorbar on the page |
|
41 if (!strcmp (obj.__colorbar__, "none")) |
|
42 axes_count++; |
|
43 endif |
6405
|
44 endswitch |
|
45 endfor |
|
46 |
6619
|
47 fputs (plot_stream, "\nreset;\n"); |
7271
|
48 fputs (plot_stream, "set autoscale fix;\n"); |
6438
|
49 |
6405
|
50 multiplot_mode = axes_count > 1; |
|
51 |
|
52 if (multiplot_mode) |
6438
|
53 fputs (plot_stream, "set multiplot;\n"); |
6405
|
54 endif |
|
55 |
|
56 for i = 1:nkids |
|
57 obj = get (kids(i)); |
|
58 switch (obj.type) |
|
59 case "axes" |
7269
|
60 __go_draw_axes__ (kids (i), plot_stream, enhanced, mono); |
6405
|
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 |