Shading between two plot lines, then removing the outline

18 ビュー (過去 30 日間)
Josh Tome
Josh Tome 2023 年 2 月 14 日
コメント済み: Les Beckham 2023 年 2 月 14 日
Hello,
I have been able to shade between two plot lines using the code below, but I would now like to remove the outline of the shaded region that is created with the patch command. If I re-execute the plot(x,y1,'color',[0.8 0.8 0.8]) and plot(x,y2,'color',[0.8 0.8 0.8]) lines of code, it colors the lines the same as the shade region, but it still leaves the dark end vertical lines at x=0 and x=100. Is there a way of making those to ends the same color as well? Thanks in advance.
x=(0:1:100);
AnkleAvg = (AnkleData(:,1))';
AnkleStDev = (AnkleData(:,2))';
y1 = AnkleAvg+AnkleStDev;
y2 = AnkleAvg-AnkleStDev;
figure
hold all
plot(x,y1,'color',[0.8 0.8 0.8])
plot(x,y2,'color',[0.8 0.8 0.8])
patch([x fliplr(x)], [y1 fliplr(y2)], [0.8 0.8 0.8])
hold off
  2 件のコメント
Josh Tome
Josh Tome 2023 年 2 月 14 日
Awesome, thank you!
Les Beckham
Les Beckham 2023 年 2 月 14 日
You are quite welcome. Thanks for accepting the Answer.

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

採用された回答

Les Beckham
Les Beckham 2023 年 2 月 14 日
編集済み: Les Beckham 2023 年 2 月 14 日
x = 0:0.01:4*pi; % create some fake data to plot
y1 = sin(x);
y2 = y1 + 0.2*x;
figure
% hold all
% plot(x,y1,'color',[0.8 0.8 0.8]) << these aren't needed
% plot(x,y2,'color',[0.8 0.8 0.8])
patch([x fliplr(x)], [y1 fliplr(y2)], [0.8 0.8 0.8], 'EdgeColor', 'none')
% hold off
grid on
When you are using a Matlab command and it isn't quite doing what you want (e.g., patch), read the documentation.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by