How to not display the first item in map legend?

2 ビュー (過去 30 日間)
P3tra_
P3tra_ 2019 年 2 月 3 日
コメント済み: P3tra_ 2019 年 2 月 3 日
Hi,
I am trying to plotm two sets of locations onto a map, with legend. However, it seemed like I can not get rid of the first thick black line off, which came from the the command worldmap. I have tried to turn off the handle visibility of the frame, put in the frame lastly so that it would appear in the legend lastly (thus easily ignored), or skip the first item, but all returned funny map.
Attached at the end is the code I am using.
figure
worldmap ([ymin ymax],[xmin xmax])
title ('mytitle')
geoshow('landareas.shp','FaceColor',[0.7 0.8 0.6])
hold on
%plot lats and lons from 1960s and 1990s and represent them in different
%colour
plotm(x1,y1,'.',...
'MarkerEdgeColor',[0.9 0.3 0.5])
plotm(x2,y2,'.',...
'MarkerEdgeColor',[0.2 0.4 0.6])
hold off
legend('','dataset1','dataset2')
Please help me to get rid of the first item of my legend :)
Thanks in advance

採用された回答

Satoshi Kobayashi
Satoshi Kobayashi 2019 年 2 月 3 日
figure
worldmap ([ymin ymax],[xmin xmax])
title ('mytitle')
geoshow('landareas.shp','FaceColor',[0.7 0.8 0.6])
hold on
%plot lats and lons from 1960s and 1990s and represent them in different
%colour
p1 = plotm(x1,y1,'.',...
'MarkerEdgeColor',[0.9 0.3 0.5])
p2 = plotm(x2,y2,'.',...
'MarkerEdgeColor',[0.2 0.4 0.6])
hold off
legend([p1 p2],'dataset1','dataset2')
  1 件のコメント
P3tra_
P3tra_ 2019 年 2 月 3 日
Works like a charm, thank you so much 3

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

その他の回答 (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