Why do LINE and PLOT not honor the default properties for a line that have been set using MATLAB 7.8 (R2009a)?

30 views (last 30 days)
I have changed the defaults for the line on an axis as below. When I plot a line using LINE or PLOT, the figure does not contain the default properties for the lines drawn as I have set them.
h = gca;
set(h, 'DefaultLineLineStyle', '-.')
set(h, 'DefaultLineMarker', 'o')
set(h, 'DefaultLineColor', 'g')
set(h, 'DefaultLineMarkerEdgeColor', 'r')
set(h, 'DefaultLineMarkerFaceColor', 'b')
hold on
plot(1,1, '*')
plot(2,2, 'o')
line([0 4], [0 -4])
line([0 4], [-1 -5], 'Color', 'g')

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Jul 2009
The changed default properties for the axis are honored if LINE is called using the low-level syntax of LINE as below:
h = gca
set(h, 'DefaultLineMarker', 'o')
set(h, 'DefaultLineColor', 'g')
set(h, 'DefaultLineMarkerEdgeColor', 'r')
set(h, 'DefaultLineMarkerFaceColor', 'b')
set(h, 'DefaultLineLineStyle', ':')
line('xdata',[0 4]', 'ydata',[0 -4]')
More information regarding low-level syntax of LINE is available at:
PLOT is a high-level function and picks up the default properties set for the figure, for example:
set(gcf,'DefaultAxesColorOrder',[1 0 0;0 1 0;0 0 1],...
t = 0:pi/20:2*pi;
a = ones(length(t),9);
for i = 1:9
a(:,i) = sin(t-i/5)';
More information regarding line styles used for plotting is available at:

More Answers (0)


Find more on Startup and Shutdown in Help Center and File Exchange


No tags entered yet.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!