Looking for a variation of waterfall plot in matla

2019-02-18 06:17发布

I have a 3-dimensional data to be plotted in matlab. The data set are built by stacking 10 exponential curves with different parameters along y directions such as

  x = 0:0.01:15;
  x0 = 0.5;
  y = [beta1, beta2, beta3, beta4, beta5, beta6, beta7, beta8, beta9, beta10];
  Z(1, :) = A*exp(-(x-x0).^2/beta1);
  Z(2, :) = A*exp(-(x-x0).^2/beta2);
  Z(3, :) = A*exp(-(x-x0).^2/beta3);
  Z(4, :) = A*exp(-(x-x0).^2/beta4);
  ...
  Z(10, :) = A*exp(-(x-x0).^2/beta10);
  % here A could be change based on beta too (no code shown here)

I am trying to plot Z with waterfall except for I don't want the height (i.e. the vertical line) appears on the edge. I don't know if there is any other way to plot the data as waterfall-like curves but without those vertical lines. Thanks

how to get rid the vertical lines as circled in the following figures

标签: matlab 3d plot
2条回答
做个烂人
2楼-- · 2019-02-18 06:35

"it is plotted with lines instead of patch with surface".
In other words, you want the boundary lines to be invisible. Well that's no trivial feat as the boundary lines are separate from any color scheme you can directly include. What you need to do is get the data after it drawn then modify it accordingly:

e.g.

[X,Y,Z] = peaks(30);
h = waterfall (X,Y,Z);
CD = get (h, 'CData');
CD(1,:) = nan;
CD(end-2:end,:) = nan;
set (h, 'CData', CD)

note that CD(1,:) is for the "rising" boundary, while CD(end-2:end-1,:) is for the falling boundary, and CD(end,:) is for the bottom.

查看更多
戒情不戒烟
3楼-- · 2019-02-18 06:39

i know this is an old post, but the below will make the region under the curve transparent:

figure;
[X,Y,Z] = peaks(10);
handle_figure = waterfall( X, Y, Z );
set( handle_figure, 'FaceColor', 'none' );
查看更多
登录 后发表回答