Question:
I’m trying to create a plot in MATLAB of ERP data. At present, the below code plots a waveform for 26 participant for channel 1, with mean amplitude on Y axis and time on X. I want to change the plot such that the waveforms are all light grey, but become darker where there are a lot of waves on top of one another.
How can I make all lines light gray and darkening where lines overlap?
Answer:
You can use the RGB-alpha quadruplet:0 0 0
for black, then change the alpha (=transparency) between 0 (invisible) and 1 (completely visible).As a side-note, this isn’t even documented in the Chart line appearance and behavior part of MATLAB’s documentation.
I can’t quite figure out when this syntax was introduced; on my R2007b it doesn’t work, but from 2017 onwards this solution starts popping up on the internet, thus I presume this was introduced with the overhaul of the graphic’s engine in R2016b.
If you have better answer, please add a comment about this, thank you!