它在左侧和右侧创建带有 y-axes 的图形。
用法
plotyy(X1,Y1,X2,Y2) // It plots X1 versus Y1 with y-axis label on the left and plot X2 versus Y2 with y-axis labeling on the right.
plotyy(X1,Y1,X2,Y2,'function') // It uses the plotting function specified by the string 'function' instead of plot to produce each graph. 'function' can be plot, semilogx, semilogy,stem,loglog etc.
plotyy(X1, Y1,X2,Y2,'function1','function2') // It uses function1(X1, Y1) to plot the information for the left-axis and function2(X2,Y2) to plot the information for the right axis.
[AX, H1, H2] = plotyy(...) // It returns the handles of the two axes generated in AX and the handle of the graphics objects from each plots in H1 and H2. AX (1) is a left axes and AX (2) is a right axes.
示例
y_1=e^-x sinx,0â¤tâ¤10
y_2=e^x
x= 1:1:10;
y1=exp(-x).*sin(x);
y2=exp(x);
Ax=plotyy(x, y1, x, y2);
hy1=get(Ax(1),'ylabel');
hy2= get(Ax(2),'ylabel');
set(hy1,'string','e^-x sin(x)');
set(hy2,'string',' e^ x');
输出:
相关用法
- MATLAB plot3()用法及代码示例
- MATLAB pcolor()用法及代码示例
- MATLAB meshz()用法及代码示例
- MATLAB contour()用法及代码示例
- MATLAB loglog()用法及代码示例
- MATLAB ribbon()用法及代码示例
- MATLAB comet()用法及代码示例
- MATLAB Stairs()用法及代码示例
- MATLAB Bar()用法及代码示例
- MATLAB contour3()用法及代码示例
- MATLAB barh()用法及代码示例
- MATLAB area()用法及代码示例
- MATLAB stem3()用法及代码示例
- MATLAB waterfall()用法及代码示例
- MATLAB quiver()用法及代码示例
- MATLAB slice()用法及代码示例
- MATLAB Semilogy()用法及代码示例
- MATLAB fill3()用法及代码示例
- MATLAB fill()用法及代码示例
- MATLAB cylinder()用法及代码示例
注:本文由纯净天空筛选整理自 MATLAB plotyy()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。