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?
Show older comments
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
Accepted Answer
More Answers (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 Comments
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
on 15 Apr 2015
pfb
on 15 Apr 2015
Interesting... I'm not sure. Perhaps "camlight" instead of "light". Take a look into the documentation "doc camlight"
Roman Kuc
on 29 May 2019
0 votes
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
on 29 Aug 2022
0 votes
trisurf(F,V(:,1),V(:,2),V(:,3),seg,'FaceColor','flat','EdgeColor','none');
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


