城市网

plotyy设置坐标轴颜色(plotyy)

导读 大家好,小城来为大家解答以上问题。plotyy设置坐标轴颜色,plotyy很多人还不知道,现在让我们一起来看看吧!plotyy函数,用于在一个图中绘...

大家好,小城来为大家解答以上问题。plotyy设置坐标轴颜色,plotyy很多人还不知道,现在让我们一起来看看吧!

plotyy函数,用于在一个图中绘制多条2D图形的一个非常常用的函数。有多种格式,下面将给出一般的使用规范。 用两个y轴绘制两个图像 x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); figure % new figure plotyy(x,y1,x,y2) 增加标题和y轴标签 x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); figure % new figure[hAx,hLine1,hLine2] = plotyy(x,y1,x,y2); title('Multiple Decay Rates') xlabel('Time (\musec)') ylabel(hAx(1),'Slow Decay') % left y-axisylabel(hAx(2),'Fast Decay') % right y-axis 更改线型 x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); [hAx,hLine1,hLine2] = plotyy(x,y1,x,y2); hLine1.LineStyle = '--'; hLine2.LineStyle = ':'; 将两种不同的线型绘制在一起 x = 0:0.1:10; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); figure plotyy(x,y1,x,y2,'plot','stem') 使用带有两个y轴的图绘制三组数据。 绘制与左侧y轴相关的一组数据。 通过使用两列矩阵绘制与右侧y轴相关联的两组数据。 x = linspace(0,10); y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); y3 = 0.2*exp(-0.5*x).*sin(10*x); figure [hAx,hLine1,hLine2] = plotyy(x,y1,[x',x'],[y2',y3']);

本文到此结束,希望对大家有所帮助。