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.

 Réponse acceptée

Star Strider
Star Strider le 19 Nov 2021

0 votes

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 commentaires

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 le 19 Nov 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 le 24 Nov 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 le 24 Nov 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 le 24 Nov 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 le 25 Nov 2021
Okay, thank you!
Star Strider
Star Strider le 25 Nov 2021
As always, my pleasure! .

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by