%% Display Axis Lines Through Origin
% This example shows how to create a plot and display the x-axis and y-axis lines so that they cross at the origin point (0,0). It also shows how to turn off the display of the axes outline.
% Create a line plot. By default, the x-axis is at the bottom of the graph and the y-axis is on the left side.

x = linspace(-10,4);
y = sin(x);
plot(x,y)

%
% Display the axis lines so that they cross at the origin point (0,0). Change the location of the x-axis and y-axis by setting the XAxisLocation and YAxisLocation properties, respectively. You can set XAxisLocation to either 'top', 'bottom', or 'origin'. You can set YAxisLocation to either 'left', 'right', or 'origin'.

ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';

%
% Turn off the display of the axes outline by setting the Box property.

ax.Box = 'off';

% Copyright 2015 The MathWorks, Inc.