example_plotyy.asv

来自「基础程序」· ASV 代码 · 共 25 行

ASV
25
字号
% example_plotyy.m
% 使用plotyy函数绘制双坐标轴图像
x1=-2.9:0.2:2.9;
y1=exp(-x1.*x1);
x2=-2.9:0.02:2.9;
y2=sin(3*x2);
[AX,H1,H2] = plotyy(x1,y1,x2,y2,'bar','plot');
% 通过句柄函数改变属性
% 添加纵坐标轴名称
set(get(AX(1),'Ylabel'),'String','y1=exp(-x.*x)');
set(get(AX(2),'Ylabel'),'String','y2=sin(3*x)');

set(H1,'barwidth',0.6,'')
% 
% 
% 
% Use the xlabel and title commands to label the x-axis and add a title: 
% xlabel('Zero to 20 \musec.')
% title('Labeling plotyy')
% 
% 
% 
% Use the line handles to set the LineStyle properties of the left- and right-side plots: 
% set(H1,'LineStyle','--')
% set(H2,'LineStyle',':

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?