How to not display the first item in map legend?
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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')
更多回答(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!