comparison scripts/plot/meshc.m @ 17066:328b579e08e9

mesh.m,meshc.m,meshz.m: Overhaul to use newplot and __plt_get_axis_arg__. * scripts/plot/mesh.m: Call __plt_get_axis_arg__ and then newplot. Fix typo in %!demo string. * scripts/plot/meshc.m: Call __plt_get_axis_arg__ and then newplot. * scripts/plot/meshz.m: Update to use new __plt_get_axis_arg__.
author Rik <rik@octave.org>
date Wed, 24 Jul 2013 23:12:46 -0700
parents c9346014fed2
children eaab03308c0b
comparison
equal deleted inserted replaced
17065:991e8a386aa3 17066:328b579e08e9
31 31
32 if (! all (cellfun ("isreal", varargin))) 32 if (! all (cellfun ("isreal", varargin)))
33 error ("meshc: X, Y, Z, C arguments must be real"); 33 error ("meshc: X, Y, Z, C arguments must be real");
34 endif 34 endif
35 35
36 newplot (); 36 [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshc", varargin{:});
37 37
38 htmp = surface (varargin{:}); 38 oldfig = ifelse (isempty (hax), [], get (0, "currentfigure"));
39 unwind_protect
40 hax = newplot (hax);
39 41
40 ax = get (htmp, "parent"); 42 htmp = surface (hax, varargin{:});
41 43
42 set (htmp, "facecolor", "w"); 44 ## FIXME - gnuplot does not support a filled surface and a
43 set (htmp, "edgecolor", "flat"); 45 ## non-filled contour. 3D filled patches are also not supported.
44 ## FIXME - gnuplot does not support a filled surface and a 46 ## Thus, the facecolor will be transparent for the gnuplot backend.
45 ## non-filled contour. 3D filled patches are also not supported. 47 set (htmp, "facecolor", "w");
46 ## Thus, the facecolor will be transparent for the gnuplot backend. 48 set (htmp, "edgecolor", "flat");
47 49
48 if (! ishold ()) 50 if (! ishold ())
49 set (ax, "view", [-37.5, 30], 51 set (hax, "view", [-37.5, 30],
50 "xgrid", "on", "ygrid", "on", "zgrid", "on"); 52 "xgrid", "on", "ygrid", "on", "zgrid", "on");
51 endif 53 endif
52 54
53 drawnow (); 55 drawnow ();
54 zmin = get (ax, "zlim")(1);
55 56
56 [~, htmp2] = __contour__ (ax, zmin, varargin{:}); 57 zmin = get (hax, "zlim")(1);
57 58
58 htmp = [htmp; htmp2]; 59 [~, htmp2] = __contour__ (hax, zmin, varargin{:});
60
61 htmp = [htmp; htmp2];
62
63 unwind_protect_cleanup
64 if (! isempty (oldfig))
65 set (0, "currentfigure", oldfig);
66 endif
67 end_unwind_protect
59 68
60 if (nargout > 0) 69 if (nargout > 0)
61 h = htmp; 70 h = htmp;
62 endif 71 endif
63 72
64 endfunction 73 endfunction
74