How to draw a surface plot without black edges in MATLAB?

99,753

Solution 1

Another choice is to set the edgeColor and/or lineStyle properties of the surface handle object to none.

>> hSurf = surf(X,Y,Z,'EdgeColor','none','LineStyle','none','FaceLighting','phong');

Solution 2

This is a more general solution, you can change the edgeColor after the surface has been created too. It does not rely on LineStyle and FaceLighting.

a= peaks(1000);
h = surf(a)
set(h, ‘edgecolor’,'none’)

Note, I have made a 45 second video that shows this occurring and how to fix it.

http://blogs.mathworks.com/videos/2008/08/13/matlab-basics-setting-edge-color-for-large-surface-plots/

Solution 3

The shading command is your friend:

shading flat - gives you the surface without mesh lines

shading interp - interpolates colours between patches to give a smooth finish

shading faceted - gives you the surface with black mesh lines (similar to flat)

Solution 4

I believe shading interp is the one you're looking for.

Share:
99,753
Jader Dias
Author by

Jader Dias

Perl, Javascript, C#, Go, Matlab and Python Developer

Updated on March 30, 2020

Comments

  • Jader Dias
    Jader Dias about 4 years

    The black lines are awful, how can I get rid of them? I want only the colored surfaces.

  • Jader Dias
    Jader Dias over 15 years
    I executed the shading flat before the surf command, but I saw no difference. Why is that?
  • Ian Hopkinson
    Ian Hopkinson over 15 years
    You need to execute it after the surf command, there may be a way of setting the default shading for a new figure, but I don't know what it is.