Specify wich values appear on a plot legend
古いコメントを表示
I'm plotting in a for loop a series of signals and additionally lines to separate segments in the plot. I want to add a Legend for each of the signal but when I add the legend it adds the lines too and Im not really sure how to take the lines out of the Legend.
My code is:
for j=1:8
figure(j)
for i=1:6
plot(f(j,:,i),cxy(j,:,i))
hold on
xlim([0 45])
line ([4,4],[0, 1],'Color','red','LineStyle','--') % Cada linea separa las bandas de energia para ver la coherencia entre bandas
line ([8,8],[0, 1],'Color','red','LineStyle','--')
line ([13,13],[0, 1],'Color','red','LineStyle','--')
line ([30,30],[0, 1],'Color','red','LineStyle','--')
% Here the legend should appear only for the plots not for the lines
legend('Signal 1','Signal 2','Signal 3','Signal 4','Signal 5', 'Signal 6')
end
end
My result is the plot I attach. I've searched arround how to solve this but nothing is working.

Thanks in advanced for the help and sorry for the basic question.
2 件のコメント
KALYAN ACHARJYA
2018 年 8 月 29 日
"how to take the lines out of the Legend?"
Which lines are you talking?
Are these lines within legend dashed colors lines?
Juan Sanchez
2018 年 8 月 29 日
編集済み: Juan Sanchez
2018 年 8 月 29 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Time Series Collections についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!