|
38 | 38 | function tf = ishold (h) |
39 | 39 |
|
40 | 40 | if (nargin == 0) |
41 | | - fig = gcf (); |
42 | | - ax = get (fig, "currentaxes"); |
| 41 | + hfig = gcf (); |
| 42 | + hax = get (hfig, "currentaxes"); |
43 | 43 | else |
44 | 44 | if (! ishghandle (h)) |
45 | 45 | error ("ishold: H must be an axes or figure graphics handle"); |
46 | 46 | endif |
47 | 47 |
|
48 | 48 | switch (get (h, "type")) |
49 | 49 | case "figure" |
50 | | - fig = h; |
51 | | - ax = get (fig, "currentaxes"); |
| 50 | + hfig = h; |
| 51 | + hax = get (hfig, "currentaxes"); |
52 | 52 |
|
53 | 53 | case "axes" |
54 | | - ax = h; |
55 | | - fig = ancestor (ax, "figure"); |
| 54 | + hax = h; |
| 55 | + hfig = ancestor (hax, "figure"); |
56 | 56 |
|
57 | 57 | otherwise |
58 | 58 | error ("ishold: H must be an axes or figure graphics handle"); |
59 | 59 |
|
60 | 60 | endswitch |
61 | 61 | endif |
62 | 62 |
|
63 | | - tf = (strcmp (get (fig, "nextplot"), "add") |
64 | | - && ! isempty (ax) && strcmp (get (ax, "nextplot"), "add")); |
| 63 | + tf = (strcmp (get (hfig, "nextplot"), "add") |
| 64 | + && ! isempty (hax) && strcmp (get (hax, "nextplot"), "add")); |
65 | 65 |
|
66 | 66 | endfunction |
67 | 67 |
|
|
83 | 83 | %! assert (get (gca, "NextPlot"), "add"); |
84 | 84 | %! assert (get (hf, "NextPlot"), "add"); |
85 | 85 | %! p = fill ([0 1 1], [0 0 1],"black"); |
86 | | -%! assert (length (get (hf, "children")), 1); |
87 | | -%! assert (length (get (gca, "children")), 2); |
| 86 | +%! assert (numel (get (hf, "children")), 1); |
| 87 | +%! assert (numel (get (gca, "children")), 2); |
| 88 | +%! set (hf, "NextPlot", "new"); |
| 89 | +%! assert (! ishold); |
| 90 | +%! assert (! ishold (gca)); |
88 | 91 | %! unwind_protect_cleanup |
89 | 92 | %! close (hf); |
90 | 93 | %! end_unwind_protect |
0 commit comments