How do I get rid of lines on a surf command? Also how do I change the surf to green rather than the default gradient colours?
Mostrar comentarios más antiguos
I am doing my University dissertation and I want rid of the lines that appear on the surface created by the surf command 'surf(xp,yp,zp)'. I have tried 'LinesVisible = FLASE' but it keeps coming up saying that the '=' is not correct. I also want to turn the surface of this plot to green.
Any help would be amazing. Am not the best on Matlab. I can send my code if that helps anyone.
Thanks Grant
Respuesta aceptada
Más respuestas (3)
It seems to me that you're guessing the syntax here. Better go through the handles.
h = surf(xp,yp,zp)
get(h)
gives you all the attribute of your surface.
You want linestyle and color
set(h,'linestyle','none','facecolor',[0 .7 0]);
and add some light
light
6 comentarios
Oh, if you have a recent version of matlab, I think you can also go like
h.linestyle='none';
h.color = [0 .7 0];
Sorry, my bad. It's
set(h,'property', 'value')
not
set('property','value')
you should do something to format your code so that it's readable. There is a button "{}code"
Also, I suggest to use ; at the end of your instructions. Defining the vectors x,y,z wouldn't hurt either;
"Doc surf" provides the documentation. At the bottom you can find out how to customize the surface.
ok, again my bad. Apologies,
it should be
set(h,'facecolor',[0 .6 0],'linestyle','none')
Do not forget the instruction for light
light
And the instruction get(h) is just for you to look at the attribute you can change. It does not do anything else but displaying all of them.
Grant V
el 15 de Abr. de 2015
pfb
el 15 de Abr. de 2015
Interesting... I'm not sure. Perhaps "camlight" instead of "light". Take a look into the documentation "doc camlight"
Roman Kuc
el 29 de Mayo de 2019
0 votos
Matlab (and Octave) work faster if the 2D mesh array is pre-allocated. This is typically done by M = zeros(nrows,ncols). I found the grid lines annoying and removed them by preallocating with M = 0.01*ones(nrow,ncols) to remove any zero values that seem to cause the problem.
Kaicheng Zhang
el 29 de Ag. de 2022
0 votos
trisurf(F,V(:,1),V(:,2),V(:,3),seg,'FaceColor','flat','EdgeColor','none');
Categorías
Más información sobre Surface and Mesh Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



