My legend does not display the right colours. Can anyone help with this?

1 ビュー (過去 30 日間)
Newbie
Newbie 2021 年 8 月 2 日
コメント済み: Bjorn Gustavsson 2021 年 8 月 2 日
Hi,
I am plotting this but my legend does not display the right colours for the lines. Can anyone help where I am going wrong? Thanks.
figure(13)
plot(T{1:156,5},T{1:156,7},'m',T{157:308,5},T{157:308,7},'m')
hold on
plot(T{1:156,5},T{1:156,12},'c',T{157:308,5},T{157:308,12},'c')

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 8 月 2 日
To gain complete control over your legending use the plot-handles that plot returns. Something like this:
figure(13)
ph1 = plot(T{1:156,5},T{1:156,7},'m',T{157:308,5},T{157:308,7},'m');
hold on
ph2 = plot(T{1:156,5},T{1:156,12},'c',T{157:308,5},T{157:308,12},'c');
legend([ph1(1),ph2(1)],'Original cortisol','Smooth cortisol')
When you have the handles to the plotted lines you can include and exclude curves you want to highlight in the legend.
HTH
  2 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 8 月 2 日
Happy that it helped.

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by