How can you plot multiple, superimposed traces such that where traces overlap, the background trace is faded?
3 次查看(过去 30 天)
显示 更早的评论
In a recent publication on imaging nerve cell activity there is a figure showing multiple lines of responses where many of the traces overlap:

The traces have been plotted in such a way that large responses "pop" out and are clearly visible. This is because when traces overlap, the background trace is faded. (The foreground trace may also be darkened...I can't really tell). Here is a higher mnagnification of a portion of the above:

MY QUESTION: Is there a way that this effect can be achieved in Matlab?
5 个评论
William Rose
2025-5-16
It would be nice to do what you propose, but certainly not necessary or expected. I've read my share of papers with such plots, and I don't think I've seen one where the "background" trace is faded out. The reader can get the idea quite effectively without that nice but hard-to-implement feature.
Good luck with your work.
回答(1 个)
Nathan
2025-5-16
编辑:Nathan
2025-5-16
Hi Stephen,
You can achieve this using 'waterfall' on your data, setting the FaceAlpha property to some fractional number, and manipulating the CData property of the patch (the first column of this is the bottom color!):
swaves = 150*real(ifft(eye(150))); % a fun way to generate cosine waves with integer fratctional periods
wf = waterfall(swaves(1:8, :)); % plot the first 8 modes
view(165, 45); % set the view angle
set(wf, 'FaceAlpha', 0.5, 'EdgeColor', 'flat', 'LineWidth', 1.2);
wf.CData(1, :) = NaN; % this removes the bottom edge
wf.CData(~isnan(wf.CData)) = 1; % set all the color data to index the top of the colormap
colormap(hex2rgb('#7da4c7')); % change the colormap to a single color
grid("off") % grid off to illustrate the lack of bottom edges
zlim([-2 2]) % scale the view angle
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!