📄 ex2801.m
字号:
%例28-1 句柄图形对象操作
%Ex28-1 create graphics by handles
clear
clc
close all
x=-2*pi:0.05*pi:2*pi;
y=sin(0.5*x).*cos(2*x);
fh=figure;
ah=axes('Parent',fh,'Layer','bottom','Position',[0.1 0.1 0.8 0.7],...
'XLim',[-8 10],'YLim',[-1 1],'XColor','b','YColor','b',...
'Box','on','XTick',[],'YTick',[]);
ahx=axes('Parent',fh,'Layer','top','Position',[0.1 0.1+0.5*0.7 0.8 eps],...
'XLim',[-8 10],'LineWidth',2.5,'XColor','m','XAxisLocation','top',...
'YColor','w','YTick',[]);
ahy=axes('Parent',fh,'Layer','top','Position',[0.1+0.8*8/18 0.1 eps 0.7],...
'YLim',[-1 1],'LineWidth',2.5,'YColor','r',...
'XColor','w','XTick',[]);
line('XData',x,'YData',y,'Parent',ah,'Color','g')
ahh=axes('Parent',fh,'Layer','top','Position',[0.68 0.12 0.2 0.2]);
set(fh,'CurrentAxes',ahh);
lh=ezplot(@(x)(sin(0.5*x).*cos(2*x)),[0.35 0.55]);
set(get(ahh,'Title'),'String','zoomed x:[0.35 0.55]','Color','b');
set(ahh,'XColor','b','YColor','b','Box','on','LineWidth',0.5,...
'XTick',[0.45],'XTickLabel','0.45','YTick',[0.13],'YTickLabel','0.13',...
'XGrid','on','YGrid','on')
set(get(ahh,'XLabel'),'String','')
set(get(ahh,'YLabel'),'String','')
set(lh,'LineStyle','--','Color','r')
set(get(ah,'Title'),'String','Handle-Graphics','FontSize',25,'Color','b')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -