Apply a color map to a 2d line

40 ビュー (過去 30 日間)
Nigel Davis
Nigel Davis 2022 年 5 月 17 日
コメント済み: Nigel Davis 2022 年 5 月 17 日
Hi
My code outputs a line graph from an array as seen below.
I need to apply a simple colourmap, say from blue to green for example, to this line from another set of values.
I think I can create the required colourmap but I don't know how to apply it to the line!
Any assistance would be greatly appriciated.
Thanks.
line(lans(1,:),1:61,'LineWidth',10)

採用された回答

KSSV
KSSV 2022 年 5 月 17 日
Read about patch
x = linspace(1,10,15);
y = sin(x);
y(end) = NaN;
c = y;
figure
patch(x,y,c,'EdgeColor','interp');
colorbar;
  1 件のコメント
Nigel Davis
Nigel Davis 2022 年 5 月 17 日
Wow thats looks like what I'm after.
I really appreciate the help, thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColor and Styling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by