How can I remove lines connecting markers?

Hello everyone,
I would like to remove the lines connecting markers and keeping just the markers (triangles,circles and asterisks). How can I do it?
Thank you.

 Respuesta aceptada

Star Strider
Star Strider el 19 de Nov. de 2021

0 votos

I am not certain what the problem actually is.
One option is instead of plotting lines (the default for the plot function), specify it to plot only the markers, for example —
plot(giulia_daily.Time(:,1),[giulia_daily.Var5(:,1) med], '.');
↑ ← SPECIFY MARKER TO PLOT ONLY THE MARKER WITHOUT CONNECTING LINES
See if that gives the desired result.
.

8 comentarios

Thank you, but I don't get anything.
plot(DYMAR(21:end), DATIMARannuali.SMB_mp_mm(21:end,1),'--co', 'MarkerEdgeColor','k','MarkerFaceColor','c', 'DisplayName','.');
The end operator must be used within an array index expression.
Star Strider
Star Strider el 19 de Nov. de 2021
This is wrong, and is throwing the error because it is a scalar, not an array:
DYMAR = datetime(DATIMARannuali.Year,1,1);
This works —
DYMAR = DATIMARannuali.Year;
plot(DYMAR(21:end), DATIMARannuali.SMB_mp_mm(21:end,1),'--co', 'MarkerEdgeColor','k','MarkerFaceColor','c', 'DisplayName','.');
Re-define ‘DYMAR’ as I did and that should solve that particular problem.
.
Pul
Pul el 24 de Nov. de 2021
Sorry for the late reply. I still see the link between markers, as you can see in the image below.
Thank you.
Star Strider
Star Strider el 24 de Nov. de 2021
My impression is that including the lines connecting the markers — rather than just the markers themselves — was the desired result.
Just change the line style to whatever works to produce the desired plot.
.
Pul
Pul el 24 de Nov. de 2021
I would like to have just markers, without the connecting lines.
Then just define the LineStyle differently —
DYMAR = DATIMARannuali.Year;
plot(DYMAR(21:end), DATIMARannuali.SMB_mp_mm(21:end,1),'co', 'MarkerEdgeColor','k','MarkerFaceColor','c', 'DisplayName','.');
That should work.
.
Pul
Pul el 25 de Nov. de 2021
Okay, thank you!
Star Strider
Star Strider el 25 de Nov. de 2021
As always, my pleasure! .

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Preguntada:

Pul
el 19 de Nov. de 2021

Editada:

Pul
el 25 de Nov. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by