假设你想将两条曲线画在左侧纵坐标,剩下三条曲线画在右侧纵坐标,示例如下:
x = rand(100,1); %模拟5条曲线数据
y = [2*rand(100,1),3*rand(100,1),4*rand(100,1),5*rand(100,1),6*rand(100,1)];
figure(1);
yyaxis left; %左侧纵坐标
p1=plot(x, y(:,1),'r','linewidth',1.5);
hold on;
p2=plot(x, y(:,2),'k-.','linewidth',1.5);
hold on;
yyaxis right; %有侧纵坐标
p3=plot(x, y(:,3),'b-*','linewidth',1.5);
hold on;
p4=plot(x, y(:,4),'y-+','linewidth',1.5);
hold on;
p5=plot(x, y(:,5),'g-o','linewidth',1.5);