Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

graph

plot

matlab

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

like image 499
Jader Dias Avatar asked Jan 11 '09 17:01

Jader Dias


People also ask

Why is my surface plot black MATLAB?

Accepted AnswerThe issue occurs when the grid which your surface is plotted over contains a large number of points. The lines which create the wire mesh surface are black by default and take precedence over the color map. In this situation, the wire grid is so dense that the lines form a completely black surface.

How do you make a surface plot transparent in MATLAB?

Direct link to this comment There is a property called alpha. After the surf command just say alpha(0.5). The value lies between 0 and 1. The closer to zero the more transparent it is.

How do I change the color of my surf plot in MATLAB?

You can change the color scheme by specifying a colormap. Colormaps are three-column arrays containing RGB triplets in which each row defines a distinct color. For example, here is a surface plot with the default color scheme. f = figure; surf(peaks);

How do I change the view of a surface plot in MATLAB?

Change View of Surface PlotUse the peaks function to get the x-, y-, and z-coordinates of a surface. Then plot the surface and label each axis. View the plot using an azimuth of 90 degrees and an elevation of 0 degrees. The new line of sight is along the x-axis.


2 Answers

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'); 
like image 148
Azim J Avatar answered Sep 30 '22 15:09

Azim J


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/

like image 37
MatlabDoug Avatar answered Sep 30 '22 16:09

MatlabDoug