How can you plot multiple, superimposed traces such that where traces overlap, the background trace is faded?

3 Ansichten (letzte 30 Tage)
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 Kommentare
William Rose
William Rose am 16 Mai 2025
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.
Stephen
Stephen am 16 Mai 2025
All true, I agree. But if there is a simple way to implement, it would be more eye-catching to readers. Whether the added effort will justify the plotting is a decision yet to be made.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Nathan
Nathan am 16 Mai 2025
Bearbeitet: Nathan am 16 Mai 2025
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

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by