Set MarkerFaceColor to plot with multiple items.

340 visualizaciones (últimos 30 días)
Lizeth Andrea Gómez Ochoa
Lizeth Andrea Gómez Ochoa el 17 de Dic. de 2021
Editada: DGM el 19 de Abr. de 2024
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.

Respuesta aceptada

Chunru
Chunru el 17 de Dic. de 2021
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 comentarios
Marguerite Bienia
Marguerite Bienia el 19 de Abr. de 2024
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 el 19 de Abr. de 2024
Editada: DGM el 19 de Abr. de 2024
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);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Discrete Data Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by