Script two_axes.m
Download Script two_axes.m
h1=figure('color','w')
h2=axes('Position',[0.06 0.06 0.90 0.90],...
'color',[0.8 0.8 0.8],'box','on')

h3=axes('Position',[.38 .15 .5 .75])

x=-pi:0.1:pi;y = sin(x);
plot(x,y),grid on

%Define the text and display it in the external axes.
str(1) = {'Plot of the sine'};
str(2) = {'function'};
str(3) = {'from'};
str(4) = {'-3.14'};
str(5) = {'to'};
str(6) = {'+3.14'};
set(gcf,'CurrentAxes',h2)
h4=text(.09,.6,str,'FontSize',10)

h_cur_Axis=get(gcf,'CurrentAxes')
get(h4);
%or
% h1_cur_Axis=gca
% str
% whos
Back