Mercurial > hg > octave-nkf
changeset 14108:5be545210fe3 stable
Trisurf() improvements.
* __go_draw_axes__.m: Revert changeset 595ee644fa6f.
Properly identify RGB cdata [1x3] for patches.
* trisurf.m: Correct bugs in converting between facevertexcdata and cdata.
This allows caxis auto to function correctly, and properly fixes bug 35144.
Add demos to explicitly test facecolor = "flat" and "interp".
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 25 Dec 2011 12:18:49 -0500 |
parents | 3eee907d79c7 |
children | 9627d5134a12 |
files | scripts/plot/private/__go_draw_axes__.m scripts/plot/private/__patch__.m scripts/plot/trisurf.m |
diffstat | 3 files changed, 29 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/private/__go_draw_axes__.m +++ b/scripts/plot/private/__go_draw_axes__.m @@ -694,25 +694,12 @@ else ccol = cdat; endif - if (strncmp (obj.facecolor, "interp", 6) && nd == 3 - && numel (xcol) == 3 && isempty (ccol)) - ## FIXME - Use isonormals to render interpolated - ## triangular patches. - obj.facecolor = "flat"; - endif if (strncmp (obj.facecolor, "flat", 4)) - if (numel (ccol) == 3) + if (isequal (size (ccol), [1, 3])) + ## RGB Triplet color = ccol; elseif (nd == 3 && numel (xcol) == 3) - if (isempty (ccol)) - z = mean (zcol); - nr = size (cmap, 1); - r = interp1 (linspace (clim(1), clim(2), nr), - (1:nr), z, "nearest", "extrap"); - color = cmap (r, :); - else - ccdat = ccol * ones (3,1); - endif + ccdat = ccol; else if (cdatadirect) r = round (ccol);
--- a/scripts/plot/private/__patch__.m +++ b/scripts/plot/private/__patch__.m @@ -274,8 +274,10 @@ c = cat(3, reshape (fvc(idx, 1), size(idx)), reshape (fvc(idx, 2), size(idx)), reshape (fvc(idx, 3), size(idx))); - else - c = []; + elseif (isempty (fvc)) + c = [] + else ## if (size (fvc, 2) == 1) + c = permute (fvc(faces), [2, 1]); endif endif args = {"xdata", x, "ydata", y, "zdata", z, "cdata", c, args{:}}; @@ -335,10 +337,8 @@ if (ndims (c) == 3) fvc = reshape (c, size (c, 1) * size (c, 2), size(c, 3)); - elseif (isvector (c)) + else fvc = c(:); - else - fvc = c.'(:); endif args = {"faces", faces, "vertices", vert, "facevertexcdata", fvc, args{:}};
--- a/scripts/plot/trisurf.m +++ b/scripts/plot/trisurf.m @@ -71,6 +71,27 @@ endfunction +%!demo +%! clf +%! N = 31; +%! [x, y] = meshgrid (1:N); +%! tri = delaunay (x, y); +%! z = peaks (N); +%! h = trisurf (tri, x, y, z, "facecolor", "interp"); +%! axis tight +%! zlim auto +%! title (sprintf ("facecolor = %s", get (h, "facecolor"))) + +%!demo +%! clf +%! N = 31; +%! [x, y] = meshgrid (1:N); +%! tri = delaunay (x, y); +%! z = peaks (N); +%! h = trisurf (tri, x, y, z, "facecolor", "flat"); +%! axis tight +%! zlim auto +%! title (sprintf ("facecolor = %s", get (h, "facecolor"))) %!demo %! clf