MATLAB: How to plot a shape away from the x and y axis

plotshape

Hi,
I want to plot shapes but I don't want them to be on the axis (I don't want to remove the axis though).
Here is my program: h=input('What shape do you want?:','s'); a=input('The length of a side is (m):'); if strcmp(h, 'square') plot([0 0 a a 0],[0 a a 0 0],'r','LineWidth',3) end

Best Answer

Just adjust the axes limits
h=input('What shape do you want?:','s');
a=input('The length of a side is (m):');
if strcmp(h, 'square')
plot([0 0 a a 0],[0 a a 0 0],'r','LineWidth',3)
xlim([-a 2*a]);
ylim([-a 2*a]);
end