How can I use horizantal lines instead of vertical lines to connect certain points?

1 回表示 (過去 30 日間)
Serhat Sayim
Serhat Sayim 2021 年 5 月 28 日
コメント済み: Serhat Sayim 2021 年 5 月 30 日
ses=structWheeze(2,1).SoundData;
flow=structWheeze(2,1).Flow;
WSFS=structWheeze(2,1).Properties.WS_SF;
WEFS=structWheeze(2,1).Properties.WE_SF;
WS_new_array=structWheeze(2,1).Properties.WS_new; %enables to define wheeze starting indices
WE_new_array=structWheeze(2,1).Properties.WE_new; %enables to define wheeze ending indices
x = linspace(0, 144000 , 144000);
figure
plot(x,ses) %enables to plot the sound
hold on, plot(flow,'c')
% legend('ses','flow')
hold on
plot(x(WS_new_array*[1 1]).',(ones(size(WS_new_array,1),2).*ylim).', 'g', 'LineWidth',2); %green markers
plot(x(WE_new_array*[1 1]).', (ones(size(WE_new_array,1),2).*ylim).', 'r', 'LineWidth',2); %red markers
plot(x(WSFS*[1 1]).',(ones(size(WSFS,1),2).*ylim).', 'y', 'LineWidth',2); %green markers
plot(x(WEFS*[1 1]).',(ones(size(WEFS,1),2).*ylim).', 'k', 'LineWidth',2); %green markers
hold off
grid

回答 (1 件)

dpb
dpb 2021 年 5 月 28 日
"replace the red and green lines with a horiz[o]ntal bar"
xb=[x(WS_new_array) flip(x(WE_new_array))];
yb=ylim*ones(size(xb));
hP=patch(xb,yb,[0.5 0 0],'FaceAlpha',0.1);
salt to suit...
Same idea for other direction, of course.
  5 件のコメント
Walter Roberson
Walter Roberson 2021 年 5 月 29 日
I do not see where you have defined the coordinates you want the horizontal lines to be drawn at.
Serhat Sayim
Serhat Sayim 2021 年 5 月 30 日
I attached the starting coordinates and ending coordinates. green lines' coordinates are startingindexes.m, red lines' coordinates are endingindexes.m

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by