Mercurial > hg > octave-nkf
diff scripts/plot/draw/mesh.m @ 19086:4d75bda5df80
mesh, meshc, surfc: Allow user provided properties to override defaults.
* mesh.m, meshc.m, surfc.m: Call underlying graphic primitive with default
properties first followed by any user properties second so that they will
override the defaults.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 04 Jul 2014 15:37:42 -0700 |
parents | d63878346099 |
children | 9a5e03801d23 |
line wrap: on
line diff
--- a/scripts/plot/draw/mesh.m +++ b/scripts/plot/draw/mesh.m @@ -70,10 +70,15 @@ unwind_protect hax = newplot (hax); - htmp = surface (varargin{:}); + mesh_props = {"facecolor", "w", "edgecolor", "flat"}; + chararg = find (cellfun ("isclass", varargin, "char"), 1); + if (isempty (chararg)) + htmp = surface (varargin{:}, mesh_props{:}); + else + htmp = surface (varargin{1:chararg-1}, mesh_props{:}, + varargin{chararg:end}); + endif - set (htmp, "facecolor", "w"); - set (htmp, "edgecolor", "flat"); if (! ishold ()) set (hax, "view", [-37.5, 30], "xgrid", "on", "ygrid", "on", "zgrid", "on"); @@ -125,3 +130,14 @@ %! title ({'Gnuplot: mesh color is wrong', 'This is a Gnuplot bug'}); %! endif +%!demo +%! clf; +%! x = logspace (0,1,11); +%! z = x'*x; +%! mesh (x, x, z, 'facecolor', 'none', 'edgecolor', 'c'); +%! xlabel 'X-axis'; +%! ylabel 'Y-axis'; +%! zlabel 'Z-axis'; +%! title ({'mesh() default properties overriden', ... +%! 'transparent mesh with cyan color'}); +