surflCreate three matrices of the same size. Then plot them as a surface using colormap-based lighting. The surface uses
Zfor height and bothZand the light source for color.
[X,Y] = meshgrid(1:0.5:10,1:20); Z = sin(X) + cos(Y); surfl(X,Y,Z) fig2plotly()
Create three matrices of the same size. Then plot them as a surface with highlights from a MATLAB® light object. The surface uses
Zfor height and bothZand the light object for color. The function returns an array containing a surface object and a lighting object. Assign it to the variablesl.
[X,Y] = meshgrid(1:0.5:10,1:20); Z = sin(X) + cos(Y); sl = surfl(X,Y,Z,'light'); fig2plotly()
Index into
slto access and modify properties of the surface object and the light object after they are created. The surface plot is accessible assl(1)and the light object assl(2). For example, change the color of the light by setting theColorproperty of the light object.
sl(2).Color = 'r'; fig2plotly()
Create three matrices of the same size to plot as a surface. Specify the direction of the light source to have an azimuth of 45 degrees and an elevation of 20 degrees. Increase the reflectance of the surface by increasing the contribution of ambient light and decreasing the contibutions of diffused and specular reflection. Assign the surface object to the variable
sl.
[X,Y] = meshgrid(1:0.5:10,1:20); Z = sin(X) + cos(Y); s = [-45 20]; k = [.65 .4 .3 10];
Plot the data using the source and reflectance vectors.
sl = surfl(X,Y,Z,s,k); fig2plotly()
Use
slto access and modify properties of the surface object after it is created. For example, hide the edges by setting theEdgeColorproperty.
sl.EdgeColor = 'none'; fig2plotly()