Mercurial > hg > octave-nkf
diff 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 |
line wrap: on
line diff
--- a/scripts/plot/meshc.m +++ b/scripts/plot/meshc.m @@ -33,32 +33,42 @@ error ("meshc: X, Y, Z, C arguments must be real"); endif - newplot (); + [hax, varargin, nargin] = __plt_get_axis_arg__ ("meshc", varargin{:}); - htmp = surface (varargin{:}); - - ax = get (htmp, "parent"); + oldfig = ifelse (isempty (hax), [], get (0, "currentfigure")); + unwind_protect + hax = newplot (hax); - set (htmp, "facecolor", "w"); - set (htmp, "edgecolor", "flat"); - ## FIXME - gnuplot does not support a filled surface and a - ## non-filled contour. 3D filled patches are also not supported. - ## Thus, the facecolor will be transparent for the gnuplot backend. + htmp = surface (hax, varargin{:}); + + ## FIXME - gnuplot does not support a filled surface and a + ## non-filled contour. 3D filled patches are also not supported. + ## Thus, the facecolor will be transparent for the gnuplot backend. + set (htmp, "facecolor", "w"); + set (htmp, "edgecolor", "flat"); - if (! ishold ()) - set (ax, "view", [-37.5, 30], - "xgrid", "on", "ygrid", "on", "zgrid", "on"); - endif + if (! ishold ()) + set (hax, "view", [-37.5, 30], + "xgrid", "on", "ygrid", "on", "zgrid", "on"); + endif + + drawnow (); + + zmin = get (hax, "zlim")(1); - drawnow (); - zmin = get (ax, "zlim")(1); + [~, htmp2] = __contour__ (hax, zmin, varargin{:}); + + htmp = [htmp; htmp2]; - [~, htmp2] = __contour__ (ax, zmin, varargin{:}); - - htmp = [htmp; htmp2]; + unwind_protect_cleanup + if (! isempty (oldfig)) + set (0, "currentfigure", oldfig); + endif + end_unwind_protect if (nargout > 0) h = htmp; endif endfunction +