fnplt, splines and figure properties - problems with inbuilt MATHWORKS function

조회 수: 4 (최근 30일)
I have some 3D data and I plot into a B-spline:
Z2 = repmat(z, [1, size(z,1)]);
tol = 0.1E-5;
sp = spaps({x,y},Z2,tol);
fnplt(sp);
(where x, y, z are (1xK) vectors.
I now wish to alter the image of my 3D surface.
for a normal plot eg
h = surf(x,y,Z2);
I would type:
set(h, 'EdgeColor','none');
set(h, 'FaceColor','interp');
set(h, 'FaceLighting','phong');
Where h is a handle. However, I cant generate a handle from fnplt.
I also see that get(gca) and get(gcf) do not allow me access to the properities I wish to set.
I can do what I want, via opening up the visual editor and doing it manually. (the auto code generator for this doesnt seem to give meaningful answers).
Am sure I have missed something obvious.
Many thanks

채택된 답변

Kwok Chong
Kwok Chong 2011년 10월 25일
Scanning through the code of fnplt.m, I can see that fnplt does not output the handle to the surface object it plots. However, it is just a normal, everyday surface object, plotted with the surf command.
So there are two ways to change the properties:
1- Grab the "points" output argument from fnplt, then plot it with surf. E.g.:
points = fnplt(sp);
h = surf(points{1},points{2},points{3});
2- Grab the handle using some handle locating function like findall. E.g.:
h = findall(gca,'type','surface');
Hope that helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Just for fun에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by