How to not display the first item in map legend?
    7 views (last 30 days)
  
       Show older comments
    
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 Comments
Accepted Answer
  Satoshi Kobayashi
      
 on 3 Feb 2019
        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') 
More Answers (0)
See Also
Categories
				Find more on Legend in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!