%% Changing Line Properties
% This example shows how to get properties of a line in MATLAB® and change line property values to customize your plot.
%
%% Line Objects
% There are several ways to create a line object in MATLAB. One way is to use the plot command. You can get the line object created by the plot command by using an output argument. The display of the line object, p, shows the most commonly used line properties, such as Color, LineStyle, and Marker.

x = 0:0.2:10;
y = besselj(0, x);

figure
p = plot(x,y)

%
%% Get Individual Line Properties
% To access individual properties, use dot notation syntax object.PropertyName. For example, the following command returns the LineWidth property of the line.

p.LineWidth

%
%% Change Line Properties
% To customize the look of your plot, change line properties using dot notation.

p.Color = [1 0 0];              % set line color to red
p.LineStyle = '--';             % set line to be dashed
p.Marker = 'square';            % use square markers
p.MarkerEdgeColor = [0 0 1];    % set marker color to blue

%
%% Get All Line Properties
% Graphics objects in MATLAB have many properties. To see all the properties of a line, use the get command.

get(p)

%
% Copyright 2014 The MathWorks, Inc.