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.

 Accepted Answer

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 Comments

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.
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.
.
Sorry for the late reply. I still see the link between markers, as you can see in the image below.
Thank you.
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.
.
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.
.
Okay, thank you!
As always, my pleasure! .

Sign in to comment.

More Answers (0)

Categories

Asked:

Pul
on 19 Nov 2021

Edited:

Pul
on 25 Nov 2021

Community Treasure Hunt

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

Start Hunting!