Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: how to control axes inside axes position?
Replies: 0

 ha chang eup Posts: 42 Registered: 2/27/09
how to control axes inside axes position?
Posted: Oct 30, 2013 5:58 AM

how to control axes inside axes position?

my code is...............

clear all;clc;close all;

XX=100; YY=200; %data point

figure(1)
line([XX],...
[YY],'LineWidth',2,'color','k' , 'LineStyle','.');

axesPos=get(gca,'position');%getting data axes position
xmin=axesPos(1);
xmax=axesPos(1)+axesPos(3);
ymin=axesPos(2);
ymax=axesPos(2)+axesPos(4);

XXlim=get(gca,'XLim');
YYlim=get(gca,'YLim');

%linear mapping on data axes position
x_a=((xmax-xmin)/(XXlim(2)-XXlim(1)))*(XX-XXlim(1))+xmin;
y_a=((ymax-ymin)/(YYlim(2)-YYlim(1)))*(YY-YYlim(1))+ymin;

ax1 = axes('Position', [x_a, y_a, axesPos(3)-0.4, axesPos(4)-0.4], ...
'XTick', [], ...
'YTick', [], ...
'Box', 'on', ...
'LineWidth', 2, ...
'Color', [0.1, 0.5, 1]);
line([0 0.3],[0 0.4])
hold on;

pause()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%after resizing axis limit position cannot touch data point
axis equal
bbb=3;
axis([-bbb bbb -bbb bbb])

after resizing axis limit, axes position cannot touch data point.

how can i control axes position??