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?
显示 更早的评论
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
采纳的回答
更多回答(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 个评论
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
2015-4-15
pfb
2015-4-15
Interesting... I'm not sure. Perhaps "camlight" instead of "light". Take a look into the documentation "doc camlight"
Roman Kuc
2019-5-29
0 个投票
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
2022-8-29
0 个投票
trisurf(F,V(:,1),V(:,2),V(:,3),seg,'FaceColor','flat','EdgeColor','none');
类别
在 帮助中心 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



