使用功能区的瀑布图 [英] waterfall plot using ribbon

查看:149
本文介绍了使用功能区的瀑布图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列光谱数据,我想以瀑布图的形式绘制. 瀑布本身并不是那么有用,因为细线在每个光谱中都有太多差异,那不是很有用.

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

我现在创建了一个手动瀑布图,该图与我想要的很接近:

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.

在此示例中,将相同的数据与瀑布,功能区和我的自定义代码一起使用.只有我的代码对可视化数据有用.我仍然想知道如何使丝带和瀑布看起来像一个不错的情节...

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);

使用功能区显示结果

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

还有瀑布

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.

推荐答案

您仍然可以使用waterfall,但可以设置一些patchaxes属性以获得更好的输出.需要注意的重要一点是spectralSeries应该换位.

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

(可选)最后一个语句myaa产生一个抗锯齿的图形;在此处获取脚本.

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

这篇关于使用功能区的瀑布图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆