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

3 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Kwok Chong
Kwok Chong il 25 Ott 2011
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!

Più risposte (0)

Categorie

Scopri di più su Just for fun in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by