Plottong double y axis with data from two different data sets for right y axis. How to create legends for two different data sets in right Y axis for MATLAB 2015a?

1 次查看(过去 30 天)
[hAx,hLine1,hLine2] = plotyy(Altitude1,OcculationAz,[Altitude1',Altitude2'],[COSMIC',Digisonde']);
title('Variation of Electron Density and Occultation Azimuth with Altitude')
xlabel('Altitude (Km)')
ylabel(hAx(1),'Occultation Azimuth (deg)') % left y-axis
ylabel(hAx(2),'Electron Density (/m3)') % right y-axis

回答(1 个)

madhan ravi
madhan ravi 2018-11-27
Try this example:
yyaxis right
plot(x,y)
hold on
plot(x1,y1)
legend({'1st','2nd'},'Location',northeast)
yyaxis left
plot(x2,y2)
legend('3rd','Location',northwest)
  1 个评论
SGMukherjee
SGMukherjee 2018-11-28
Can you tell me how to use different markers and two different legends for two red line plots? I am working with MATLAB R2015a.
[hAx,hLine1,hLine2] = plotyy(Altitude1,OcculationAz,[Altitude1',Altitude2'],[COSMIC',Digisonde']);
hLine1.Marker = 'o';
hLine2.Marker = '*';
title('Variation of Electron Density and Occultation Azimuth with Altitude')
xlabel('Altitude (Km)')
ylabel(hAx(1),'Occultation Azimuth (deg)') % left y-axis
ylabel(hAx(2),'Electron Density (/m3)') % right y-axis
legend('Occultation Azimuth','COSMIC','Digisonde','Location','NorthEastOutside')

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by