MATLAB: Color of line plot with marker problem

color of line plot with marker

I want to draw a line plot with color, and find the solution here:
the problem is that, it can only control the color of the marker, not the line. I tried to improve the command from:
x = linspace(0,10,50);
y = sin(x);
plot(x,y,'-s','MarkerSize',10,...
'MarkerEdgeColor','red',...
'MarkerFaceColor',[1 .6 .6])
to:
x = linspace(0,10,50);
y = sin(x);
plot(x,y,'r','-s','MarkerSize',10,...
'MarkerEdgeColor','red',...
'MarkerFaceColor',[1 .6 .6])
Matlab reports error.
is there anyway to control the color of both the line and marker together?
Thanks!
Yu

Best Answer

The color of the line is controlled by the 'color' parameter.
x = linspace(0,10,50);
y = sin(x);
plot(x,y,'-s','MarkerSize',10,...
'MarkerEdgeColor','red',...
'MarkerFaceColor',[1 .6 .6], 'color' 'r') % 'color' added