How can you plot multiple, superimposed traces such that where traces overlap, the background trace is faded?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
William Rose
el 16 de Mayo de 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.
Respuestas (1)
Nathan
el 16 de Mayo de 2025
Editada: Nathan
el 16 de Mayo de 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
Ver también
Categorías
Más información sobre Graphics Object Programming en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!