How to not display the first item in map legend?

3 vues (au cours des 30 derniers jours)
P3tra_
P3tra_ le 3 Fév 2019
Commenté : P3tra_ le 3 Fév 2019
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

Réponse acceptée

Satoshi Kobayashi
Satoshi Kobayashi le 3 Fév 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')
  1 commentaire
P3tra_
P3tra_ le 3 Fév 2019
Works like a charm, thank you so much 3

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by