How can I customize the line width in the figure generated by "plotsigroi"?

3 views (last 30 days)
I am using "plotsigroi" to plot signal regions based on a signal mask. I am looking for a way to customize the line width of the plots using the command line. How can this be achieved?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 24 Jan 2024
Though you cannot customize the line width directly when calling the "plotrigsoi", you can output the axes handle returned by "plotsigroi" and modify the properties of the children. Below is an example that can help you understand how it works:
1. Consider a mask of binary sequences for two categories, "ran" and "dom". Use the sequences to generate a "signalMask" object. Discard regions fewer than 3 samples:
>> rng default
>> sq = randi(2,200,2)-1;
>> m = signalMask(sq,"MinLength",3,"Categories",["ran" "dom"]);
2. Generate a sequence of 200 random numbers. Call "plotsigroi" and store the returned axes handle into "h":
>> x = rand(200,1);
>> h = plotsigroi(m,x); % output the axes handle
This should plot the result like this:
3. Get the children of "h", which is a "3x1 graphics array" containing three instances of "Line":
>> ls=h.Children
ls =
3×1 graphics array:
Line
Line
Line
4. Modify the line width as you desire:
>> ls(1).LineWidth = 0.2; % line width for the red line
>> ls(2).LineWidth = 2; % line width for the blue line
>> ls(3).LineWidth = 0.5; % line width for the black line
And now the plot looks like this:

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!