I wanna fill with color the figure 'o' of my plot, but I know how. My plot is this way:
plot(X1,Y1,LineSpec1,...,Xn,Yn,Linespecn)
And I tried with this:
plot(X1,Y1,'om','MarkerFaceColor','k',...,Xn,Yn,LineSpecn)
But it didn't work.

 채택된 답변

Chunru
Chunru 2021년 12월 17일
n = 10;
x1 =(1:n)';
y1 = rand(10, 1);
x2 = (1:n);
y2 = rand(10,1);
% Use separate plot when you need to specify additional properties
plot(x1, y1, 'om-', 'MarkerFaceColor','k');
hold on
plot(x2, y2, 'ob:', 'MarkerFaceColor','r');

댓글 수: 5

Ohhhhhhhh :D Thanks!!!
Brian
Brian 2023년 5월 17일
If I want to use the automatic color sequencing that plot provides, I cannot use an explicit color for MarkerFaceColor. How do I get the face to fill with the automatically cycled color?
Assign the line color (in defaut color order) to MarkerFaceColor
n = 10;
x1 =(1:n)';
y1 = rand(10, 1);
x2 = (1:n);
y2 = rand(10,1);
% Use separate plot when you need to specify additional properties
p = plot(x1, y1, 'o-');
p.MarkerFaceColor = p.Color;
hold on
p1= plot(x2, y2, 'o:');
p1.MarkerFaceColor = p1.Color;
sorry this does not work for y data in a matrix because all curves are plotted with a single command. Is there no simple way to have filled markers (such as in scatter plot)?
DGM
DGM 2024년 4월 19일
편집: DGM 2024년 4월 19일
Consider the example:
x =(0:10)';
y = rand(11,3); % multiple series in one matrix
p = plot(x, y, 'o-');
[p.MarkerFaceColor] = deal(p.Color);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2021년 12월 17일

편집:

DGM
2024년 4월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by