pop_ploterps plot waves in accordance to a color scheme

2 views (last 30 days)
I am trying to avoid the cycling of colors in pop_ploterps (in bold). I want my plot waves to follow a uniform color scheme like parula, I tried replacing it with the rgb and hex format but linespec only accepts strings. Is there any way that I could do this?
ERP = pop_ploterps( ERP, 1:50, [1:64] , 'AutoYlim', 'on', 'Axsize', [ 0.05 0.08], 'BinNum', 'on', 'Blc', 'pre', 'Box',...
[ 3 4], 'ChLabel', 'on', 'FontSizeChan', 10, 'FontSizeLeg', 12, 'FontSizeTicks', 10, 'LegPos', 'none', 'Linespec', {'k-' , 'r-' , 'b-' ,...
'g-' , 'c-' , 'm-' , 'y-' , 'w-' , 'k-' , 'r-' , 'b-' , 'g-' , 'c-' , 'm-' , 'y-' , 'w-' , 'k-' , 'r-' , 'b-' , 'g-' , 'c-' , 'm-' , 'y-' ,...
'w-' , 'k-' , 'r-' , 'b-' , 'g-' , 'c-' , 'm-' , 'y-' , 'w-' , 'k-' , 'r-' , 'b-' , 'g-' , 'c-' , 'm-' , 'y-' , 'w-' , 'k-' , 'r-' , 'b-' ,...
'g-' , 'c-' , 'm-' , 'y-' , 'w-' , 'k-' , 'r-' }, 'LineWidth', 0.3, 'Maximize', 'on', 'Position', [ 24.5 11.5 106.875 31.9444], 'Style',...
'Classic', 'Tag', 'ERP_figure', 'Transparency', 0, 'xscale', [ -100.0 4999.0 -50 0:800:4000 ], 'YDir', 'normal' );
Thank you!

Answers (1)

Shubham
Shubham on 22 Jan 2024
Edited: Shubham on 22 Jan 2024
Hey Maemi Jane,
Although I don't have access to the EEGLAB toolbox, I can offer some ideas on how waves might be plotted using a color gradient.
You can alter the 'ColorOrder' axes-property to plot multiple waves in accordance with a color scheme. For instance, check out the following example:
You can apply a color gradient within the same wave using the "surface" or "patch" functions. Have a look at the following MATLAB Answer case:
You can plot your desired dataset using either function as mentioned. You can use colormaps like "Parula". Refer to the following code snippet:
x = linspace(0, 2*pi, 100);
y = cos(x);
patch([x nan],[y nan],[y nan],[x nan], 'edgecolor', 'interp');
colorbar;
colormap(parula);
Additionally, you can make changes to an existing line plot and add gradient to it. Refer to the following code snippet:
n=100;
x = linspace(0, 2*pi, n);
y = cos(x);
plot_handle = plot(x,y,'r');
cd = [uint8(parula(n)*255) uint8(ones(n,1))].';
drawnow;
set(plot_handle.Edge, 'ColorBinding','interpolated', 'ColorData',cd);
I hope this helps.

Categories

Find more on Graphics Performance in Help Center and File Exchange

Tags

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!