MATLAB: Can I display 2 legends while using the plotyy function

MATLABmultiple legendsplotyy

I've been asked to add a 2nd legend to an existing M-file where the objective is to display altitude and SV IDs using the plotyy function. I'm working with the following code:
% Plot altitude and SV IDs with NER State Time and add title
figure('Name','Altitude and SV IDs','numbertitle','off');
[AX,H1,H2] = plotyy(State_Time, Alt, State_Time, SV_ID, 'plot');
set(AX, 'Fontsize', 16, 'XTickLabel',num2str(get(gca,'XTick')','%d'));
title(Event_Title,'FontSize', 20);
% Define axes properties
axes(AX(1));
ylabel('Altitude (m)','Fontsize', 20,'fontweight','b');
xlabel('UTC (Sec)','Fontsize', 20,'fontweight','b');
axes(AX(2));
ylabel('SV ID','Fontsize', 20,'fontweight','b');
% Set the markers, markersizes, and linestyles
set(H1,'Marker','o','MarkerSize',15);
set(H2,'Marker','+','MarkerSize',15);
set(H2,'LineStyle','none');
% Add first and 2nd legends for data source
legend(Source, 'Location', 'NortheastOutside');
legend('SV_ID', 'Location', 'EastOutside');
I'm new to using the plotyy function and the problem I'm running into is the displaying of both legends simultaneously.
Is the displaying of both legends tied to the plotyy function itself?

Best Answer

legend({Source,'SV_ID'}, 'Location', 'NortheastOutside');