MATLAB: Plot a line and point marker with color unspecified

plot

For any other marker,
plot(x,y,'-o')
plots a line with the marker identifier. However,
plot(x,y,'-.')
plots a dashed-dot line. As a workaround, I usually specify the color, '-k.' to force the plot to have a solid line with point markers. However, this messes up the usual order of colors when plotting multiple data sets. Is there a way to programmatically plot a solid line with a point marker while not specifying the color?
Thanks.

Best Answer

You can be explicit that you want to change the Marker property of the line created by plot.
% Sample data
x = 1:10;
y = x.^2;
% Plot with 'o' Marker
figure
plot(x, y, '-', 'Marker', 'o')
% Plot with '.' Marker
figure
plot(x, y, '-', 'Marker', '.')
You can specify any of the modifiable properties of the line returned by plot in this way. If you want to be completely explicitly clear, you could use both LineStyle and Marker.
figure
plot(x, y, 'Marker', '.', 'LineStyle', '-')