Legends as pointers in matlab plot
11 ビュー (過去 30 日間)
古いコメントを表示
I have plotted a India map and over that, I have used geoshow to show few stations. I have assigned all the plane stations by blue dots and other stations by black triangular dots. How can I put these two things in the legend in matlab plot?
0 件のコメント
採用された回答
Walter Roberson
2017 年 10 月 24 日
The easiest way is to create a fake graphics object with coordinates NaN, NaN but with the appropriate shape and color and line attributes; do this repeatedly for each entry and record the handles. Then legend() against those handles with appropriate text in a cell array.
For example,
L(1) = plot(nan, nan, 'b.', 'MarkerSize', 5);
T{1} = 'Urmar Tanda';
L(2) = plot(nan, nan, 'b*', 'MarkerSize', 5);
T{2} = 'Pattamundai';
L(3) = plot(nan, nan, 'kv', 'MarkerSize', 8);
T{3} = 'Lakheri';
L(4) = plot(nan, nan, 'k^', 'MarkerSize', 8);
T{4} = 'Sirsa';
legend(L, T)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!