How do I make a mesh or surface plot that is clear in certain places?

25 次查看(过去 30 天)
I want to create a SURF or MESH plot but would like the surface to have empty regions or holes in specific places.

采纳的回答

MathWorks Support Team
If the surface or mesh data has a NaN (not-a-number) in it, then the location of the NaN will be blank (just as NaNs in 2-d plots leave blanks). The example below illustrates using NaNs to make certain parts of a plot transparent.
%Generate a SURF plot with peaks data
z = peaks;
surf(z)
%Change peaks data so that a portion of that matix is made up of NaNs
m = z;
m(15:30,15:30) = nan;
%Plot the new matrix, m where the x and y information consisting of NaNs
%represents a hole in the SURF plot
figure;
surf(m)
As of MATLAB 6.0 (R12) you can use transparency to set a face to be transparent.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by