フィルターのクリア

Iterative plot and legend with symbol and color change

1 回表示 (過去 30 日間)
Aviad Aviad
Aviad Aviad 2018 年 5 月 25 日
コメント済み: jonas 2018 年 5 月 25 日
Hi, How do I plot (markers only) and legend two vectors of the same (unknown) size, where the color and symbol change every ten steps? Thanks.
  3 件のコメント
Aviad Aviad
Aviad Aviad 2018 年 5 月 25 日
編集済み: Aviad Aviad 2018 年 5 月 25 日
I did something like this but it's not so good since it assumes that my data vector size is a multiple of 6:
figure;
colors = {'r','g','b','m','k','r','g','b','m','k'};
markers = {'+','o','*','p','x','s','d','+','v','>','<','.','h'};
legendText = cell(n/6, 1); for i=1:6:n-5
iteration = fix(i/6)+1; plot(data1(i:i+5), data2(i:i+5), [colors{iteration}, markers{iteration}]); hold on; legendText{iteration} = sprintf('Curve: %d', iteration);
end
legend(legendText, 'Location', 'southwest');
Is there a better, more robust way to accomplish this?
jonas
jonas 2018 年 5 月 25 日
If you post a complete code (please select the text and click code to format it before posting) then I can run it and have a look. Alternatively, upload a figure of your desired output

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

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by