我有一系列光谱数据,我想将它们绘制成瀑布式图。 瀑布本身并没有多大用处,因为细线在每个光谱中都有太多差异,这不是很有用
因此我想尝试功能区功能,它在 docs 中看起来很有前途。 .
但是结果完全不同,而且没用!
figure(2); clf;
ribbon(spectralSeries);
shading flat % otherwise complete dark
axis tight
编辑:
我现在创建了一个手动瀑布图,它接近我想要的:
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
尽管如此,我仍然对原始问题的解决方案感兴趣。
编辑2:
这里是一个使用相同数据与瀑布、功能区和我的自定义代码的示例。只有我的代码对可视化数据有用。我仍然想知道如何使丝带和瀑布看起来像一个像样的情节......
此代码现在用于创建一些数据
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;
为了进行比较,使用我自己编写的代码绘制了一个图,它类似于瀑布,但没有深度轴。然而,它是唯一一个看起来不错并显示数据曲线以便可以看到每条曲线之间的变化的。
最佳答案
您仍然可以使用waterfall
,但设置一些patch
和axes
属性以获得更好的输出。需要注意的重要一点是 spectralSeries
应该被转置。
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
生成一个抗锯齿图形;获取脚本 here .
关于matlab - 使用丝带的瀑布图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9393825/