waterfall plot using ribbon

2020-07-24 05:23发布

问题:

I have a series of spectral data which I want to plot in a waterfall style plot. waterfall itsself is no that usefull, because the thin lines have too many differences in each spectrum, that is is not very usefull

I therefore want to try the ribbon function, which looks promising in the docs .

But the result is completely different and useless!

figure(2); clf;
ribbon(spectralSeries); 
shading flat % otherwise complete dark
axis tight

EDIT:

I created now a manual waterfall plot, which is close to what I wanted:

hold on;
stepsize = 0.35;
for k = length(series):-1:1
    color = cmap(k,:);
    data = spectralSeries(k,:) + (k-1)*stepsize;

    hplot(k) = filledcurve(xaxis, data, 0);       
    set(hplot(k), 'FaceColor' , color*1.2)
    set(hplot(k), 'EdgeColor' , color*0.5)    
end
hold off;
axis tight

Nevertheless I am still interested in a solution of the original problem.

EDIT 2:

Here an example using the same data with waterfall, ribbon and my custom code. Only my code is usefull to visualise the data. I would still like to know how to make ribbon and waterfall look like a decent plot...

This code is now used to create some data

xaxis = linspace(-pi/2,3/2*pi, 1000);
variation = [ 0.5 1 5 10];
spectralSeries = abs(sin(xaxis)'*ones(1,4) + sin(xaxis'*variation)*0.25);

Here a result using ribbon

ribbon(spectralSeries); 
shading flat % otherwise complete dark
axis tight

And here with waterfall

hplot = waterfall(spectralSeries);
set( hplot, 'LineWidth', 4 );
hidden off;

and for comparison a plot using my own written code, which is similar to a waterfall, but without the depth axis. However it is the only one which looks decent and displays the data curves such that the variations between each curve can be seen.

回答1:

You can still use waterfall, but set some patch and axes properties to get nicer output. The important thing to notice is that spectralSeries should be transposed.

figure
xaxis = linspace(-pi/2,3/2*pi, 200);
variation = [ 0.5 1 5 10 7 3.5 8];
spectralSeries = abs(sin(xaxis)'*ones(1,7) + sin(xaxis'*variation)*0.25);
h = waterfall(spectralSeries');
cameratoolbar;

%%
set(h, 'FaceColor', 'flat');
set(h, 'FaceAlpha', 0.7);
set(h, 'EdgeColor', 'k');
set(h, 'FaceVertexCData', rand(7,3))
set(gca, 'Color', [1 1 1]*0.85)
set(gca, 'GridLineStyle', 'none');

%%
myaa

The (optional) last statement, myaa, produces an anti-aliased figure; get the script here.